• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_DOWNLOAD_SAVE_FILE_H_
6 #define CHROME_BROWSER_DOWNLOAD_SAVE_FILE_H_
7 #pragma once
8 
9 #include "base/basictypes.h"
10 #include "base/file_path.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/download/base_file.h"
13 #include "chrome/browser/download/save_types.h"
14 
15 // SaveFile ----------------------------------------------------------------
16 
17 // These objects live exclusively on the file thread and handle the writing
18 // operations for one save item. These objects live only for the duration that
19 // the saving job is 'in progress': once the saving job has been completed or
20 // canceled, the SaveFile is destroyed. One SaveFile object represents one item
21 // in a save session.
22 class SaveFile : public BaseFile {
23  public:
24   explicit SaveFile(const SaveFileCreateInfo* info);
25   ~SaveFile();
26 
27   // Accessors.
save_id()28   int save_id() const { return info_->save_id; }
render_process_id()29   int render_process_id() const { return info_->render_process_id; }
render_view_id()30   int render_view_id() const { return info_->render_view_id; }
request_id()31   int request_id() const { return info_->request_id; }
save_source()32   SaveFileCreateInfo::SaveFileSource save_source() const {
33     return info_->save_source;
34   }
35 
36  private:
37   scoped_ptr<const SaveFileCreateInfo> info_;
38 
39   DISALLOW_COPY_AND_ASSIGN(SaveFile);
40 };
41 
42 #endif  // CHROME_BROWSER_DOWNLOAD_SAVE_FILE_H_
43