Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: content/browser/download/download_file_impl.h

Issue 10689093: Move Rename functionality from DownloadFileManager to DownloadFileImple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload fater merging past revert to figure out if I still have a patch. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_
7 7
8 #include "content/browser/download/download_file.h" 8 #include "content/browser/download/download_file.h"
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 22 matching lines...) Expand all
33 scoped_ptr<content::ByteStreamReader> stream, 33 scoped_ptr<content::ByteStreamReader> stream,
34 DownloadRequestHandleInterface* request_handle, 34 DownloadRequestHandleInterface* request_handle,
35 scoped_refptr<content::DownloadManager> download_manager, 35 scoped_refptr<content::DownloadManager> download_manager,
36 bool calculate_hash, 36 bool calculate_hash,
37 scoped_ptr<content::PowerSaveBlocker> power_save_blocker, 37 scoped_ptr<content::PowerSaveBlocker> power_save_blocker,
38 const net::BoundNetLog& bound_net_log); 38 const net::BoundNetLog& bound_net_log);
39 virtual ~DownloadFileImpl(); 39 virtual ~DownloadFileImpl();
40 40
41 // DownloadFile functions. 41 // DownloadFile functions.
42 virtual content::DownloadInterruptReason Initialize() OVERRIDE; 42 virtual content::DownloadInterruptReason Initialize() OVERRIDE;
43 virtual content::DownloadInterruptReason Rename( 43 virtual void Rename(const FilePath& full_path,
44 const FilePath& full_path) OVERRIDE; 44 bool overwrite_existing_file,
45 const RenameCompletionCallback& callback) OVERRIDE;
45 virtual void Detach() OVERRIDE; 46 virtual void Detach() OVERRIDE;
46 virtual void Cancel() OVERRIDE; 47 virtual void Cancel() OVERRIDE;
47 virtual void AnnotateWithSourceInformation() OVERRIDE; 48 virtual void AnnotateWithSourceInformation() OVERRIDE;
48 virtual FilePath FullPath() const OVERRIDE; 49 virtual FilePath FullPath() const OVERRIDE;
49 virtual bool InProgress() const OVERRIDE; 50 virtual bool InProgress() const OVERRIDE;
50 virtual int64 BytesSoFar() const OVERRIDE; 51 virtual int64 BytesSoFar() const OVERRIDE;
51 virtual int64 CurrentSpeed() const OVERRIDE; 52 virtual int64 CurrentSpeed() const OVERRIDE;
52 virtual bool GetHash(std::string* hash) OVERRIDE; 53 virtual bool GetHash(std::string* hash) OVERRIDE;
53 virtual std::string GetHashState() OVERRIDE; 54 virtual std::string GetHashState() OVERRIDE;
54 virtual void CancelDownloadRequest() OVERRIDE; 55 virtual void CancelDownloadRequest() OVERRIDE;
55 virtual int Id() const OVERRIDE; 56 virtual int Id() const OVERRIDE;
56 virtual content::DownloadManager* GetDownloadManager() OVERRIDE; 57 virtual content::DownloadManager* GetDownloadManager() OVERRIDE;
57 virtual const content::DownloadId& GlobalId() const OVERRIDE; 58 virtual const content::DownloadId& GlobalId() const OVERRIDE;
58 virtual std::string DebugString() const OVERRIDE; 59 virtual std::string DebugString() const OVERRIDE;
59 60
60 protected: 61 protected:
61 // For test class overrides. 62 // For test class overrides.
62 virtual content::DownloadInterruptReason AppendDataToFile( 63 virtual content::DownloadInterruptReason AppendDataToFile(
63 const char* data, size_t data_len); 64 const char* data, size_t data_len);
64 65
65 private: 66 private:
67 // Send an update on our progress.
68 void SendUpdate();
69
66 // Called when there's some activity on stream_reader_ that needs to be 70 // Called when there's some activity on stream_reader_ that needs to be
67 // handled. 71 // handled.
68 void StreamActive(); 72 void StreamActive();
69 73
70 // Send updates on our progress.
71 void SendUpdate();
72
73 // The base file instance. 74 // The base file instance.
74 BaseFile file_; 75 BaseFile file_;
75 76
76 // The stream through which data comes. 77 // The stream through which data comes.
77 // TODO(rdsmith): Move this into BaseFile; requires using the same 78 // TODO(rdsmith): Move this into BaseFile; requires using the same
78 // stream semantics in SavePackage. Alternatively, replace SaveFile 79 // stream semantics in SavePackage. Alternatively, replace SaveFile
79 // with DownloadFile and get rid of BaseFile. 80 // with DownloadFile and get rid of BaseFile.
80 scoped_ptr<content::ByteStreamReader> stream_reader_; 81 scoped_ptr<content::ByteStreamReader> stream_reader_;
81 82
82 // The unique identifier for this download, assigned at creation by 83 // The unique identifier for this download, assigned at creation by
(...skipping 19 matching lines...) Expand all
102 103
103 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; 104 base::WeakPtrFactory<DownloadFileImpl> weak_factory_;
104 105
105 // RAII handle to keep the system from sleeping while we're downloading. 106 // RAII handle to keep the system from sleeping while we're downloading.
106 scoped_ptr<content::PowerSaveBlocker> power_save_blocker_; 107 scoped_ptr<content::PowerSaveBlocker> power_save_blocker_;
107 108
108 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); 109 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl);
109 }; 110 };
110 111
111 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ 112 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_file.h ('k') | content/browser/download/download_file_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698