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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 #include "chrome/browser/download/chrome_download_manager_delegate.h" 5 #include "chrome/browser/download/chrome_download_manager_delegate.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/download/download_status_updater.h" 25 #include "chrome/browser/download/download_status_updater.h"
26 #include "chrome/browser/download/download_util.h" 26 #include "chrome/browser/download/download_util.h"
27 #include "chrome/browser/download/save_package_file_picker.h" 27 #include "chrome/browser/download/save_package_file_picker.h"
28 #include "chrome/browser/extensions/api/downloads/downloads_api.h" 28 #include "chrome/browser/extensions/api/downloads/downloads_api.h"
29 #include "chrome/browser/extensions/crx_installer.h" 29 #include "chrome/browser/extensions/crx_installer.h"
30 #include "chrome/browser/extensions/extension_service.h" 30 #include "chrome/browser/extensions/extension_service.h"
31 #include "chrome/browser/prefs/pref_member.h" 31 #include "chrome/browser/prefs/pref_member.h"
32 #include "chrome/browser/prefs/pref_service.h" 32 #include "chrome/browser/prefs/pref_service.h"
33 #include "chrome/browser/profiles/profile.h" 33 #include "chrome/browser/profiles/profile.h"
34 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 34 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
35 #include "chrome/browser/ui/browser_tabstrip.h"
35 #include "chrome/common/chrome_notification_types.h" 36 #include "chrome/common/chrome_notification_types.h"
36 #include "chrome/common/chrome_paths.h" 37 #include "chrome/common/chrome_paths.h"
37 #include "chrome/common/extensions/extension_switch_utils.h" 38 #include "chrome/common/extensions/extension_switch_utils.h"
38 #include "chrome/common/extensions/user_script.h" 39 #include "chrome/common/extensions/user_script.h"
39 #include "chrome/common/pref_names.h" 40 #include "chrome/common/pref_names.h"
40 #include "content/public/browser/download_item.h" 41 #include "content/public/browser/download_item.h"
41 #include "content/public/browser/download_manager.h" 42 #include "content/public/browser/download_manager.h"
42 #include "content/public/browser/notification_source.h" 43 #include "content/public/browser/notification_source.h"
43 #include "content/public/browser/web_contents.h" 44 #include "content/public/browser/web_contents.h"
44 #include "content/public/browser/web_contents_delegate.h" 45 #include "content/public/browser/web_contents_delegate.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 WebContents* ChromeDownloadManagerDelegate:: 214 WebContents* ChromeDownloadManagerDelegate::
214 GetAlternativeWebContentsToNotifyForDownload() { 215 GetAlternativeWebContentsToNotifyForDownload() {
215 #if defined(OS_ANDROID) 216 #if defined(OS_ANDROID)
216 // Android does not implement BrowserList or any other way to get an 217 // Android does not implement BrowserList or any other way to get an
217 // alternate web contents. 218 // alternate web contents.
218 return NULL; 219 return NULL;
219 #else 220 #else
220 // Start the download in the last active browser. This is not ideal but better 221 // Start the download in the last active browser. This is not ideal but better
221 // than fully hiding the download from the user. 222 // than fully hiding the download from the user.
222 Browser* last_active = browser::FindLastActiveWithProfile(profile_); 223 Browser* last_active = browser::FindLastActiveWithProfile(profile_);
223 return last_active ? last_active->GetActiveWebContents() : NULL; 224 return last_active ? chrome::GetActiveWebContents(last_active) : NULL;
224 #endif 225 #endif
225 } 226 }
226 227
227 bool ChromeDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( 228 bool ChromeDownloadManagerDelegate::ShouldOpenFileBasedOnExtension(
228 const FilePath& path) { 229 const FilePath& path) {
229 FilePath::StringType extension = path.Extension(); 230 FilePath::StringType extension = path.Extension();
230 if (extension.empty()) 231 if (extension.empty())
231 return false; 232 return false;
232 if (extensions::Extension::IsExtension(path)) 233 if (extensions::Extension::IsExtension(path))
233 return false; 234 return false;
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 int32 download_id, int64 db_handle) { 852 int32 download_id, int64 db_handle) {
852 // It's not immediately obvious, but HistoryBackend::CreateDownload() can 853 // It's not immediately obvious, but HistoryBackend::CreateDownload() can
853 // call this function with an invalid |db_handle|. For instance, this can 854 // call this function with an invalid |db_handle|. For instance, this can
854 // happen when the history database is offline. We cannot have multiple 855 // happen when the history database is offline. We cannot have multiple
855 // DownloadItems with the same invalid db_handle, so we need to assign a 856 // DownloadItems with the same invalid db_handle, so we need to assign a
856 // unique |db_handle| here. 857 // unique |db_handle| here.
857 if (db_handle == DownloadItem::kUninitializedHandle) 858 if (db_handle == DownloadItem::kUninitializedHandle)
858 db_handle = download_history_->GetNextFakeDbHandle(); 859 db_handle = download_history_->GetNextFakeDbHandle();
859 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); 860 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle);
860 } 861 }
OLDNEW
« no previous file with comments | « chrome/browser/debugger/devtools_window.cc ('k') | chrome/browser/download/download_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698