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

Side by Side Diff: chrome/browser/download/chrome_download_manager_delegate.h

Issue 665253002: Standardize usage of virtual/override/final in chrome/browser/download/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_
6 #define CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ 6 #define CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 23 matching lines...) Expand all
34 class PrefRegistrySyncable; 34 class PrefRegistrySyncable;
35 } 35 }
36 36
37 // This is the Chrome side helper for the download system. 37 // This is the Chrome side helper for the download system.
38 class ChromeDownloadManagerDelegate 38 class ChromeDownloadManagerDelegate
39 : public content::DownloadManagerDelegate, 39 : public content::DownloadManagerDelegate,
40 public content::NotificationObserver, 40 public content::NotificationObserver,
41 public DownloadTargetDeterminerDelegate { 41 public DownloadTargetDeterminerDelegate {
42 public: 42 public:
43 explicit ChromeDownloadManagerDelegate(Profile* profile); 43 explicit ChromeDownloadManagerDelegate(Profile* profile);
44 virtual ~ChromeDownloadManagerDelegate(); 44 ~ChromeDownloadManagerDelegate() override;
45 45
46 // Should be called before the first call to ShouldCompleteDownload() to 46 // Should be called before the first call to ShouldCompleteDownload() to
47 // disable SafeBrowsing checks for |item|. 47 // disable SafeBrowsing checks for |item|.
48 static void DisableSafeBrowsing(content::DownloadItem* item); 48 static void DisableSafeBrowsing(content::DownloadItem* item);
49 49
50 void SetDownloadManager(content::DownloadManager* dm); 50 void SetDownloadManager(content::DownloadManager* dm);
51 51
52 // Callbacks passed to GetNextId() will not be called until the returned 52 // Callbacks passed to GetNextId() will not be called until the returned
53 // callback is called. 53 // callback is called.
54 content::DownloadIdCallback GetDownloadIdReceiverCallback(); 54 content::DownloadIdCallback GetDownloadIdReceiverCallback();
55 55
56 // content::DownloadManagerDelegate 56 // content::DownloadManagerDelegate
57 virtual void Shutdown() override; 57 void Shutdown() override;
58 virtual void GetNextId(const content::DownloadIdCallback& callback) override; 58 void GetNextId(const content::DownloadIdCallback& callback) override;
59 virtual bool DetermineDownloadTarget( 59 bool DetermineDownloadTarget(
60 content::DownloadItem* item, 60 content::DownloadItem* item,
61 const content::DownloadTargetCallback& callback) override; 61 const content::DownloadTargetCallback& callback) override;
62 virtual bool ShouldOpenFileBasedOnExtension( 62 bool ShouldOpenFileBasedOnExtension(const base::FilePath& path) override;
63 const base::FilePath& path) override; 63 bool ShouldCompleteDownload(content::DownloadItem* item,
64 virtual bool ShouldCompleteDownload( 64 const base::Closure& complete_callback) override;
65 content::DownloadItem* item, 65 bool ShouldOpenDownload(
66 const base::Closure& complete_callback) override;
67 virtual bool ShouldOpenDownload(
68 content::DownloadItem* item, 66 content::DownloadItem* item,
69 const content::DownloadOpenDelayedCallback& callback) override; 67 const content::DownloadOpenDelayedCallback& callback) override;
70 virtual bool GenerateFileHash() override; 68 bool GenerateFileHash() override;
71 virtual void GetSaveDir(content::BrowserContext* browser_context, 69 void GetSaveDir(content::BrowserContext* browser_context,
72 base::FilePath* website_save_dir, 70 base::FilePath* website_save_dir,
73 base::FilePath* download_save_dir, 71 base::FilePath* download_save_dir,
74 bool* skip_dir_check) override; 72 bool* skip_dir_check) override;
75 virtual void ChooseSavePath( 73 void ChooseSavePath(
76 content::WebContents* web_contents, 74 content::WebContents* web_contents,
77 const base::FilePath& suggested_path, 75 const base::FilePath& suggested_path,
78 const base::FilePath::StringType& default_extension, 76 const base::FilePath::StringType& default_extension,
79 bool can_save_as_complete, 77 bool can_save_as_complete,
80 const content::SavePackagePathPickedCallback& callback) override; 78 const content::SavePackagePathPickedCallback& callback) override;
81 virtual void OpenDownload(content::DownloadItem* download) override; 79 void OpenDownload(content::DownloadItem* download) override;
82 virtual void ShowDownloadInShell(content::DownloadItem* download) override; 80 void ShowDownloadInShell(content::DownloadItem* download) override;
83 virtual void CheckForFileExistence( 81 void CheckForFileExistence(
84 content::DownloadItem* download, 82 content::DownloadItem* download,
85 const content::CheckForFileExistenceCallback& callback) override; 83 const content::CheckForFileExistenceCallback& callback) override;
86 virtual std::string ApplicationClientIdForFileScanning() const override; 84 std::string ApplicationClientIdForFileScanning() const override;
87 85
88 // Opens a download using the platform handler. DownloadItem::OpenDownload, 86 // Opens a download using the platform handler. DownloadItem::OpenDownload,
89 // which ends up being handled by OpenDownload(), will open a download in the 87 // which ends up being handled by OpenDownload(), will open a download in the
90 // browser if doing so is preferred. 88 // browser if doing so is preferred.
91 void OpenDownloadUsingPlatformHandler(content::DownloadItem* download); 89 void OpenDownloadUsingPlatformHandler(content::DownloadItem* download);
92 90
93 DownloadPrefs* download_prefs() { return download_prefs_.get(); } 91 DownloadPrefs* download_prefs() { return download_prefs_.get(); }
94 92
95 protected: 93 protected:
96 // So that test classes that inherit from this for override purposes 94 // So that test classes that inherit from this for override purposes
97 // can call back into the DownloadManager. 95 // can call back into the DownloadManager.
98 content::DownloadManager* download_manager_; 96 content::DownloadManager* download_manager_;
99 97
100 virtual safe_browsing::DownloadProtectionService* 98 virtual safe_browsing::DownloadProtectionService*
101 GetDownloadProtectionService(); 99 GetDownloadProtectionService();
102 100
103 // DownloadTargetDeterminerDelegate. Protected for testing. 101 // DownloadTargetDeterminerDelegate. Protected for testing.
104 virtual void NotifyExtensions( 102 void NotifyExtensions(content::DownloadItem* download,
105 content::DownloadItem* download, 103 const base::FilePath& suggested_virtual_path,
106 const base::FilePath& suggested_virtual_path, 104 const NotifyExtensionsCallback& callback) override;
107 const NotifyExtensionsCallback& callback) override; 105 void ReserveVirtualPath(
108 virtual void ReserveVirtualPath(
109 content::DownloadItem* download, 106 content::DownloadItem* download,
110 const base::FilePath& virtual_path, 107 const base::FilePath& virtual_path,
111 bool create_directory, 108 bool create_directory,
112 DownloadPathReservationTracker::FilenameConflictAction conflict_action, 109 DownloadPathReservationTracker::FilenameConflictAction conflict_action,
113 const ReservedPathCallback& callback) override; 110 const ReservedPathCallback& callback) override;
114 virtual void PromptUserForDownloadPath( 111 void PromptUserForDownloadPath(content::DownloadItem* download,
115 content::DownloadItem* download, 112 const base::FilePath& suggested_virtual_path,
116 const base::FilePath& suggested_virtual_path, 113 const FileSelectedCallback& callback) override;
117 const FileSelectedCallback& callback) override; 114 void DetermineLocalPath(content::DownloadItem* download,
118 virtual void DetermineLocalPath( 115 const base::FilePath& virtual_path,
119 content::DownloadItem* download, 116 const LocalPathCallback& callback) override;
120 const base::FilePath& virtual_path, 117 void CheckDownloadUrl(content::DownloadItem* download,
121 const LocalPathCallback& callback) override; 118 const base::FilePath& suggested_virtual_path,
122 virtual void CheckDownloadUrl( 119 const CheckDownloadUrlCallback& callback) override;
123 content::DownloadItem* download, 120 void GetFileMimeType(const base::FilePath& path,
124 const base::FilePath& suggested_virtual_path, 121 const GetFileMimeTypeCallback& callback) override;
125 const CheckDownloadUrlCallback& callback) override;
126 virtual void GetFileMimeType(
127 const base::FilePath& path,
128 const GetFileMimeTypeCallback& callback) override;
129 122
130 private: 123 private:
131 friend class base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>; 124 friend class base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>;
132 125
133 typedef std::vector<content::DownloadIdCallback> IdCallbackVector; 126 typedef std::vector<content::DownloadIdCallback> IdCallbackVector;
134 127
135 // content::NotificationObserver implementation. 128 // content::NotificationObserver implementation.
136 virtual void Observe(int type, 129 void Observe(int type,
137 const content::NotificationSource& source, 130 const content::NotificationSource& source,
138 const content::NotificationDetails& details) override; 131 const content::NotificationDetails& details) override;
139 132
140 // Callback function after the DownloadProtectionService completes. 133 // Callback function after the DownloadProtectionService completes.
141 void CheckClientDownloadDone( 134 void CheckClientDownloadDone(
142 uint32 download_id, 135 uint32 download_id,
143 safe_browsing::DownloadProtectionService::DownloadCheckResult result); 136 safe_browsing::DownloadProtectionService::DownloadCheckResult result);
144 137
145 // Internal gateways for ShouldCompleteDownload(). 138 // Internal gateways for ShouldCompleteDownload().
146 bool IsDownloadReadyForCompletion( 139 bool IsDownloadReadyForCompletion(
147 content::DownloadItem* item, 140 content::DownloadItem* item,
148 const base::Closure& internal_complete_callback); 141 const base::Closure& internal_complete_callback);
(...skipping 26 matching lines...) Expand all
175 #endif 168 #endif
176 169
177 content::NotificationRegistrar registrar_; 170 content::NotificationRegistrar registrar_;
178 171
179 base::WeakPtrFactory<ChromeDownloadManagerDelegate> weak_ptr_factory_; 172 base::WeakPtrFactory<ChromeDownloadManagerDelegate> weak_ptr_factory_;
180 173
181 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); 174 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate);
182 }; 175 };
183 176
184 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ 177 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/all_download_item_notifier.h ('k') | chrome/browser/download/chrome_download_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698