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

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

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

Powered by Google App Engine
This is Rietveld 408576698