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

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

Issue 11941015: Move OpenItem/ShowItemInFolder from ContentBrowserClient to DownloadManagerDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 7 years, 11 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 15 matching lines...) Expand all
26 #include "chrome/browser/download/download_status_updater.h" 26 #include "chrome/browser/download/download_status_updater.h"
27 #include "chrome/browser/download/download_util.h" 27 #include "chrome/browser/download/download_util.h"
28 #include "chrome/browser/download/save_package_file_picker.h" 28 #include "chrome/browser/download/save_package_file_picker.h"
29 #include "chrome/browser/extensions/api/downloads/downloads_api.h" 29 #include "chrome/browser/extensions/api/downloads/downloads_api.h"
30 #include "chrome/browser/extensions/crx_installer.h" 30 #include "chrome/browser/extensions/crx_installer.h"
31 #include "chrome/browser/extensions/extension_service.h" 31 #include "chrome/browser/extensions/extension_service.h"
32 #include "chrome/browser/extensions/extension_system.h" 32 #include "chrome/browser/extensions/extension_system.h"
33 #include "chrome/browser/history/history.h" 33 #include "chrome/browser/history/history.h"
34 #include "chrome/browser/history/history_service_factory.h" 34 #include "chrome/browser/history/history_service_factory.h"
35 #include "chrome/browser/intents/web_intents_util.h" 35 #include "chrome/browser/intents/web_intents_util.h"
36 #include "chrome/browser/platform_util.h"
36 #include "chrome/browser/prefs/pref_service.h" 37 #include "chrome/browser/prefs/pref_service.h"
37 #include "chrome/browser/profiles/profile.h" 38 #include "chrome/browser/profiles/profile.h"
38 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 39 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
39 #include "chrome/browser/ui/browser_tabstrip.h" 40 #include "chrome/browser/ui/browser_tabstrip.h"
40 #include "chrome/browser/ui/host_desktop.h" 41 #include "chrome/browser/ui/host_desktop.h"
41 #include "chrome/common/chrome_notification_types.h" 42 #include "chrome/common/chrome_notification_types.h"
42 #include "chrome/common/extensions/feature_switch.h" 43 #include "chrome/common/extensions/feature_switch.h"
43 #include "chrome/common/extensions/user_script.h" 44 #include "chrome/common/extensions/user_script.h"
44 #include "chrome/common/pref_names.h" 45 #include "chrome/common/pref_names.h"
45 #include "content/public/browser/download_item.h" 46 #include "content/public/browser/download_item.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 const content::SavePackagePathPickedCallback& callback) { 517 const content::SavePackagePathPickedCallback& callback) {
517 // Deletes itself. 518 // Deletes itself.
518 #if defined(OS_CHROMEOS) 519 #if defined(OS_CHROMEOS)
519 new SavePackageFilePickerChromeOS(web_contents, suggested_path, callback); 520 new SavePackageFilePickerChromeOS(web_contents, suggested_path, callback);
520 #else 521 #else
521 new SavePackageFilePicker(web_contents, suggested_path, default_extension, 522 new SavePackageFilePicker(web_contents, suggested_path, default_extension,
522 can_save_as_complete, download_prefs_.get(), callback); 523 can_save_as_complete, download_prefs_.get(), callback);
523 #endif 524 #endif
524 } 525 }
525 526
527 void ChromeDownloadManagerDelegate::OpenDownload(DownloadItem* download) {
528 platform_util::OpenItem(download->GetFullPath());
529 }
530
531 void ChromeDownloadManagerDelegate::ShowDownloadInShell(
532 DownloadItem* download) {
533 platform_util::ShowItemInFolder(download->GetFullPath());
534 }
535
526 void ChromeDownloadManagerDelegate::ClearLastDownloadPath() { 536 void ChromeDownloadManagerDelegate::ClearLastDownloadPath() {
527 last_download_path_.clear(); 537 last_download_path_.clear();
528 } 538 }
529 539
530 DownloadProtectionService* 540 DownloadProtectionService*
531 ChromeDownloadManagerDelegate::GetDownloadProtectionService() { 541 ChromeDownloadManagerDelegate::GetDownloadProtectionService() {
532 #if defined(FULL_SAFE_BROWSING) 542 #if defined(FULL_SAFE_BROWSING)
533 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); 543 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service();
534 if (sb_service && sb_service->download_protection_service() && 544 if (sb_service && sb_service->download_protection_service() &&
535 profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) { 545 profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) {
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 // TODO(asanka): This logic is a hack. DownloadFilePicker should give us a 865 // TODO(asanka): This logic is a hack. DownloadFilePicker should give us a
856 // directory to persist. Or perhaps, if the Drive path 866 // directory to persist. Or perhaps, if the Drive path
857 // substitution logic is moved here, then we would have a 867 // substitution logic is moved here, then we would have a
858 // persistable path after the DownloadFilePicker is done. 868 // persistable path after the DownloadFilePicker is done.
859 if (disposition == DownloadItem::TARGET_DISPOSITION_PROMPT && 869 if (disposition == DownloadItem::TARGET_DISPOSITION_PROMPT &&
860 !download->IsTemporary()) 870 !download->IsTemporary())
861 last_download_path_ = target_path.DirName(); 871 last_download_path_ = target_path.DirName();
862 } 872 }
863 callback.Run(target_path, disposition, danger_type, intermediate_path); 873 callback.Run(target_path, disposition, danger_type, intermediate_path);
864 } 874 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698