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

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

Issue 2887933002: Remove usage of SequencedWorkerPool::GetNamedSequenceToken from ChromeDownloadManagerDelegate. (Closed)
Patch Set: Created 3 years, 7 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/containers/hash_tables.h" 15 #include "base/containers/hash_tables.h"
16 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/sequenced_task_runner.h"
19 #include "chrome/browser/download/download_path_reservation_tracker.h" 20 #include "chrome/browser/download/download_path_reservation_tracker.h"
20 #include "chrome/browser/download/download_target_determiner_delegate.h" 21 #include "chrome/browser/download/download_target_determiner_delegate.h"
21 #include "chrome/browser/download/download_target_info.h" 22 #include "chrome/browser/download/download_target_info.h"
22 #include "chrome/browser/safe_browsing/download_protection_service.h" 23 #include "chrome/browser/safe_browsing/download_protection_service.h"
23 #include "content/public/browser/download_danger_type.h" 24 #include "content/public/browser/download_danger_type.h"
24 #include "content/public/browser/download_item.h" 25 #include "content/public/browser/download_item.h"
25 #include "content/public/browser/download_manager_delegate.h" 26 #include "content/public/browser/download_manager_delegate.h"
26 #include "content/public/browser/notification_observer.h" 27 #include "content/public/browser/notification_observer.h"
27 #include "content/public/browser/notification_registrar.h" 28 #include "content/public/browser/notification_registrar.h"
28 #include "extensions/features/features.h" 29 #include "extensions/features/features.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 content::WebContents* web_contents, 79 content::WebContents* web_contents,
79 const base::FilePath& suggested_path, 80 const base::FilePath& suggested_path,
80 const base::FilePath::StringType& default_extension, 81 const base::FilePath::StringType& default_extension,
81 bool can_save_as_complete, 82 bool can_save_as_complete,
82 const content::SavePackagePathPickedCallback& callback) override; 83 const content::SavePackagePathPickedCallback& callback) override;
83 void SanitizeSavePackageResourceName(base::FilePath* filename) override; 84 void SanitizeSavePackageResourceName(base::FilePath* filename) override;
84 void OpenDownload(content::DownloadItem* download) override; 85 void OpenDownload(content::DownloadItem* download) override;
85 void ShowDownloadInShell(content::DownloadItem* download) override; 86 void ShowDownloadInShell(content::DownloadItem* download) override;
86 void CheckForFileExistence( 87 void CheckForFileExistence(
87 content::DownloadItem* download, 88 content::DownloadItem* download,
88 const content::CheckForFileExistenceCallback& callback) override; 89 content::CheckForFileExistenceCallback callback) override;
89 std::string ApplicationClientIdForFileScanning() const override; 90 std::string ApplicationClientIdForFileScanning() const override;
90 91
91 // Opens a download using the platform handler. DownloadItem::OpenDownload, 92 // Opens a download using the platform handler. DownloadItem::OpenDownload,
92 // which ends up being handled by OpenDownload(), will open a download in the 93 // which ends up being handled by OpenDownload(), will open a download in the
93 // browser if doing so is preferred. 94 // browser if doing so is preferred.
94 void OpenDownloadUsingPlatformHandler(content::DownloadItem* download); 95 void OpenDownloadUsingPlatformHandler(content::DownloadItem* download);
95 96
96 DownloadPrefs* download_prefs() { return download_prefs_.get(); } 97 DownloadPrefs* download_prefs() { return download_prefs_.get(); }
97 98
98 protected: 99 protected:
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 std::unique_ptr<DownloadTargetInfo> target_info); 162 std::unique_ptr<DownloadTargetInfo> target_info);
162 163
163 // Returns true if |path| should open in the browser. 164 // Returns true if |path| should open in the browser.
164 bool IsOpenInBrowserPreferreredForFile(const base::FilePath& path); 165 bool IsOpenInBrowserPreferreredForFile(const base::FilePath& path);
165 166
166 Profile* profile_; 167 Profile* profile_;
167 uint32_t next_download_id_; 168 uint32_t next_download_id_;
168 IdCallbackVector id_callbacks_; 169 IdCallbackVector id_callbacks_;
169 std::unique_ptr<DownloadPrefs> download_prefs_; 170 std::unique_ptr<DownloadPrefs> download_prefs_;
170 171
172 // SequencedTaskRunner to check for file existence. A sequence is used so that
173 // a large download history doesn't cause a large number of concurrent disk
174 // operations.
175 const scoped_refptr<base::SequencedTaskRunner>
176 check_for_file_existence_task_runner_;
177
171 #if BUILDFLAG(ENABLE_EXTENSIONS) 178 #if BUILDFLAG(ENABLE_EXTENSIONS)
172 // Maps from pending extension installations to DownloadItem IDs. 179 // Maps from pending extension installations to DownloadItem IDs.
173 typedef base::hash_map<extensions::CrxInstaller*, 180 typedef base::hash_map<extensions::CrxInstaller*,
174 content::DownloadOpenDelayedCallback> CrxInstallerMap; 181 content::DownloadOpenDelayedCallback> CrxInstallerMap;
175 CrxInstallerMap crx_installers_; 182 CrxInstallerMap crx_installers_;
176 #endif 183 #endif
177 184
178 content::NotificationRegistrar registrar_; 185 content::NotificationRegistrar registrar_;
179 186
180 base::WeakPtrFactory<ChromeDownloadManagerDelegate> weak_ptr_factory_; 187 base::WeakPtrFactory<ChromeDownloadManagerDelegate> weak_ptr_factory_;
181 188
182 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate); 189 DISALLOW_COPY_AND_ASSIGN(ChromeDownloadManagerDelegate);
183 }; 190 };
184 191
185 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_ 192 #endif // CHROME_BROWSER_DOWNLOAD_CHROME_DOWNLOAD_MANAGER_DELEGATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/download_handler.cc ('k') | chrome/browser/download/chrome_download_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698