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

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

Issue 55063002: Prefer opening PDF downloads in the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Destroy PluginService once we are done with our plugin tests. Created 7 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/download/chrome_download_manager_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/download/download_path_reservation_tracker.h" 12 #include "chrome/browser/download/download_path_reservation_tracker.h"
13 #include "chrome/browser/download/download_target_determiner_delegate.h" 13 #include "chrome/browser/download/download_target_determiner_delegate.h"
14 #include "chrome/browser/download/download_target_info.h"
14 #include "chrome/browser/safe_browsing/download_protection_service.h" 15 #include "chrome/browser/safe_browsing/download_protection_service.h"
15 #include "content/public/browser/download_danger_type.h" 16 #include "content/public/browser/download_danger_type.h"
16 #include "content/public/browser/download_item.h" 17 #include "content/public/browser/download_item.h"
17 #include "content/public/browser/download_manager_delegate.h" 18 #include "content/public/browser/download_manager_delegate.h"
18 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
19 #include "content/public/browser/notification_registrar.h" 20 #include "content/public/browser/notification_registrar.h"
20 21
21 class DownloadPrefs; 22 class DownloadPrefs;
22 class Profile; 23 class Profile;
23 24
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 const base::FilePath::StringType& default_extension, 89 const base::FilePath::StringType& default_extension,
89 bool can_save_as_complete, 90 bool can_save_as_complete,
90 const content::SavePackagePathPickedCallback& callback) OVERRIDE; 91 const content::SavePackagePathPickedCallback& callback) OVERRIDE;
91 virtual void OpenDownload(content::DownloadItem* download) OVERRIDE; 92 virtual void OpenDownload(content::DownloadItem* download) OVERRIDE;
92 virtual void ShowDownloadInShell(content::DownloadItem* download) OVERRIDE; 93 virtual void ShowDownloadInShell(content::DownloadItem* download) OVERRIDE;
93 virtual void CheckForFileExistence( 94 virtual void CheckForFileExistence(
94 content::DownloadItem* download, 95 content::DownloadItem* download,
95 const content::CheckForFileExistenceCallback& callback) OVERRIDE; 96 const content::CheckForFileExistenceCallback& callback) OVERRIDE;
96 virtual std::string ApplicationClientIdForFileScanning() const OVERRIDE; 97 virtual std::string ApplicationClientIdForFileScanning() const OVERRIDE;
97 98
99 // Opens a download using the platform handler. DownloadItem::OpenDownload,
100 // which ends up being handled by OpenDownload(), will open a download in the
101 // browser if doing so is preferred.
102 void OpenDownloadUsingPlatformHandler(content::DownloadItem* download);
103
98 DownloadPrefs* download_prefs() { return download_prefs_.get(); } 104 DownloadPrefs* download_prefs() { return download_prefs_.get(); }
99 105
100 protected: 106 protected:
101 // So that test classes can inherit from this for override purposes. 107 // So that test classes can inherit from this for override purposes.
102 virtual ~ChromeDownloadManagerDelegate(); 108 virtual ~ChromeDownloadManagerDelegate();
103 109
104 // So that test classes that inherit from this for override purposes 110 // So that test classes that inherit from this for override purposes
105 // can call back into the DownloadManager. 111 // can call back into the DownloadManager.
106 content::DownloadManager* download_manager_; 112 content::DownloadManager* download_manager_;
107 113
(...skipping 16 matching lines...) Expand all
124 const base::FilePath& suggested_virtual_path, 130 const base::FilePath& suggested_virtual_path,
125 const FileSelectedCallback& callback) OVERRIDE; 131 const FileSelectedCallback& callback) OVERRIDE;
126 virtual void DetermineLocalPath( 132 virtual void DetermineLocalPath(
127 content::DownloadItem* download, 133 content::DownloadItem* download,
128 const base::FilePath& virtual_path, 134 const base::FilePath& virtual_path,
129 const LocalPathCallback& callback) OVERRIDE; 135 const LocalPathCallback& callback) OVERRIDE;
130 virtual void CheckDownloadUrl( 136 virtual void CheckDownloadUrl(
131 content::DownloadItem* download, 137 content::DownloadItem* download,
132 const base::FilePath& suggested_virtual_path, 138 const base::FilePath& suggested_virtual_path,
133 const CheckDownloadUrlCallback& callback) OVERRIDE; 139 const CheckDownloadUrlCallback& callback) OVERRIDE;
140 virtual void GetFileMimeType(
141 const base::FilePath& path,
142 const GetFileMimeTypeCallback& callback) OVERRIDE;
134 143
135 private: 144 private:
136 friend class base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>; 145 friend class base::RefCountedThreadSafe<ChromeDownloadManagerDelegate>;
137 146
138 typedef std::vector<content::DownloadIdCallback> IdCallbackVector; 147 typedef std::vector<content::DownloadIdCallback> IdCallbackVector;
139 148
140 // content::NotificationObserver implementation. 149 // content::NotificationObserver implementation.
141 virtual void Observe(int type, 150 virtual void Observe(int type,
142 const content::NotificationSource& source, 151 const content::NotificationSource& source,
143 const content::NotificationDetails& details) OVERRIDE; 152 const content::NotificationDetails& details) OVERRIDE;
144 153
145 // Callback function after the DownloadProtectionService completes. 154 // Callback function after the DownloadProtectionService completes.
146 void CheckClientDownloadDone( 155 void CheckClientDownloadDone(
147 uint32 download_id, 156 uint32 download_id,
148 safe_browsing::DownloadProtectionService::DownloadCheckResult result); 157 safe_browsing::DownloadProtectionService::DownloadCheckResult result);
149 158
150 // Internal gateways for ShouldCompleteDownload(). 159 // Internal gateways for ShouldCompleteDownload().
151 bool IsDownloadReadyForCompletion( 160 bool IsDownloadReadyForCompletion(
152 content::DownloadItem* item, 161 content::DownloadItem* item,
153 const base::Closure& internal_complete_callback); 162 const base::Closure& internal_complete_callback);
154 void ShouldCompleteDownloadInternal( 163 void ShouldCompleteDownloadInternal(
155 uint32 download_id, 164 uint32 download_id,
156 const base::Closure& user_complete_callback); 165 const base::Closure& user_complete_callback);
157 166
158 void ReturnNextId(const content::DownloadIdCallback& callback); 167 void ReturnNextId(const content::DownloadIdCallback& callback);
159 168
169 void OnDownloadTargetDetermined(
170 int32 download_id,
171 const content::DownloadTargetCallback& callback,
172 scoped_ptr<DownloadTargetInfo> target_info);
173
160 Profile* profile_; 174 Profile* profile_;
161 uint32 next_download_id_; 175 uint32 next_download_id_;
162 IdCallbackVector id_callbacks_; 176 IdCallbackVector id_callbacks_;
163 scoped_ptr<DownloadPrefs> download_prefs_; 177 scoped_ptr<DownloadPrefs> download_prefs_;
164 178
165 // Maps from pending extension installations to DownloadItem IDs. 179 // Maps from pending extension installations to DownloadItem IDs.
166 typedef base::hash_map<extensions::CrxInstaller*, 180 typedef base::hash_map<extensions::CrxInstaller*,
167 content::DownloadOpenDelayedCallback> CrxInstallerMap; 181 content::DownloadOpenDelayedCallback> CrxInstallerMap;
168 CrxInstallerMap crx_installers_; 182 CrxInstallerMap crx_installers_;
169 183
170 content::NotificationRegistrar registrar_; 184 content::NotificationRegistrar registrar_;
171 185
172 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); 186 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate);
173 }; 187 };
174 188
175 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ 189 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/chrome_download_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698