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

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

Issue 10689093: Move Rename functionality from DownloadFileManager to DownloadFileImple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to TOT to avoid showing already committed changes in Rietveld. 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 // The DownloadFileManager owns a set of DownloadFile objects, each of which 5 // The DownloadFileManager owns a set of DownloadFile objects, each of which
6 // represent one in progress download and performs the disk IO for that 6 // represent one in progress download and performs the disk IO for that
7 // download. The DownloadFileManager itself is a singleton object owned by the 7 // download. The DownloadFileManager itself is a singleton object owned by the
8 // ResourceDispatcherHostImpl. 8 // ResourceDispatcherHostImpl.
9 // 9 //
10 // The DownloadFileManager uses the file_thread for performing file write 10 // The DownloadFileManager uses the file_thread for performing file write
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include <map> 43 #include <map>
44 44
45 #include "base/atomic_sequence_num.h" 45 #include "base/atomic_sequence_num.h"
46 #include "base/basictypes.h" 46 #include "base/basictypes.h"
47 #include "base/callback_forward.h" 47 #include "base/callback_forward.h"
48 #include "base/gtest_prod_util.h" 48 #include "base/gtest_prod_util.h"
49 #include "base/hash_tables.h" 49 #include "base/hash_tables.h"
50 #include "base/memory/ref_counted.h" 50 #include "base/memory/ref_counted.h"
51 #include "base/memory/scoped_ptr.h" 51 #include "base/memory/scoped_ptr.h"
52 #include "base/timer.h" 52 #include "base/timer.h"
53 #include "content/browser/download/download_file.h"
53 #include "content/common/content_export.h" 54 #include "content/common/content_export.h"
54 #include "content/public/browser/download_id.h" 55 #include "content/public/browser/download_id.h"
55 #include "content/public/browser/download_interrupt_reasons.h" 56 #include "content/public/browser/download_interrupt_reasons.h"
56 #include "net/base/net_errors.h" 57 #include "net/base/net_errors.h"
57 #include "ui/gfx/native_widget_types.h" 58 #include "ui/gfx/native_widget_types.h"
58 59
59 struct DownloadCreateInfo; 60 struct DownloadCreateInfo;
60 class DownloadRequestHandle; 61 class DownloadRequestHandle;
61 class FilePath; 62 class FilePath;
62 63
63 namespace content { 64 namespace content {
64 class ByteStreamReader; 65 class ByteStreamReader;
65 class DownloadFile;
66 class DownloadId; 66 class DownloadId;
67 class DownloadManager; 67 class DownloadManager;
68 } 68 }
69 69
70 namespace net { 70 namespace net {
71 class BoundNetLog; 71 class BoundNetLog;
72 } 72 }
73 73
74 // Manages all in progress downloads. 74 // Manages all in progress downloads.
75 // Methods are virtual to allow mocks--this class is not intended 75 // Methods are virtual to allow mocks--this class is not intended
76 // to be a base class. 76 // to be a base class.
77 class CONTENT_EXPORT DownloadFileManager 77 class CONTENT_EXPORT DownloadFileManager
78 : public base::RefCountedThreadSafe<DownloadFileManager> { 78 : public base::RefCountedThreadSafe<DownloadFileManager> {
79 public: 79 public:
80 // Callback used with CreateDownloadFile(). |reason| will be 80 // Callback used with CreateDownloadFile(). |reason| will be
81 // DOWNLOAD_INTERRUPT_REASON_NONE on a successful creation. 81 // DOWNLOAD_INTERRUPT_REASON_NONE on a successful creation.
82 typedef base::Callback<void(content::DownloadInterruptReason reason)> 82 typedef base::Callback<void(content::DownloadInterruptReason reason)>
83 CreateDownloadFileCallback; 83 CreateDownloadFileCallback;
84 84
85 // Callback used with RenameDownloadFile(). 85 // Callback used with RenameDownloadFile().
86 typedef base::Callback<void(const FilePath&)> RenameCompletionCallback; 86 typedef content::DownloadFile::RenameCompletionCallback
87 RenameCompletionCallback;
87 88
88 class DownloadFileFactory { 89 class DownloadFileFactory {
89 public: 90 public:
90 virtual ~DownloadFileFactory() {} 91 virtual ~DownloadFileFactory() {}
91 92
92 virtual content::DownloadFile* CreateFile( 93 virtual content::DownloadFile* CreateFile(
93 DownloadCreateInfo* info, 94 DownloadCreateInfo* info,
94 scoped_ptr<content::ByteStreamReader> stream, 95 scoped_ptr<content::ByteStreamReader> stream,
95 content::DownloadManager* download_manager, 96 content::DownloadManager* download_manager,
96 bool calculate_hash, 97 bool calculate_hash,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 172
172 // A map of all in progress downloads. It owns the download files. 173 // A map of all in progress downloads. It owns the download files.
173 DownloadFileMap downloads_; 174 DownloadFileMap downloads_;
174 175
175 scoped_ptr<DownloadFileFactory> download_file_factory_; 176 scoped_ptr<DownloadFileFactory> download_file_factory_;
176 177
177 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager); 178 DISALLOW_COPY_AND_ASSIGN(DownloadFileManager);
178 }; 179 };
179 180
180 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_ 181 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698