OLD | NEW |
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 11 matching lines...) Expand all Loading... |
22 #include "chrome/browser/download/download_file_picker.h" | 22 #include "chrome/browser/download/download_file_picker.h" |
23 #include "chrome/browser/download/download_history.h" | 23 #include "chrome/browser/download/download_history.h" |
24 #include "chrome/browser/download/download_path_reservation_tracker.h" | 24 #include "chrome/browser/download/download_path_reservation_tracker.h" |
25 #include "chrome/browser/download/download_prefs.h" | 25 #include "chrome/browser/download/download_prefs.h" |
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/history/history.h" | 33 #include "chrome/browser/history/history.h" |
33 #include "chrome/browser/history/history_service_factory.h" | 34 #include "chrome/browser/history/history_service_factory.h" |
34 #include "chrome/browser/intents/web_intents_util.h" | 35 #include "chrome/browser/intents/web_intents_util.h" |
35 #include "chrome/browser/prefs/pref_service.h" | 36 #include "chrome/browser/prefs/pref_service.h" |
36 #include "chrome/browser/profiles/profile.h" | 37 #include "chrome/browser/profiles/profile.h" |
37 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 38 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
38 #include "chrome/browser/ui/browser_tabstrip.h" | 39 #include "chrome/browser/ui/browser_tabstrip.h" |
39 #include "chrome/browser/ui/host_desktop.h" | 40 #include "chrome/browser/ui/host_desktop.h" |
40 #include "chrome/common/chrome_notification_types.h" | 41 #include "chrome/common/chrome_notification_types.h" |
41 #include "chrome/common/extensions/feature_switch.h" | 42 #include "chrome/common/extensions/feature_switch.h" |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 return false; | 404 return false; |
404 | 405 |
405 #if !defined(OS_CHROMEOS) | 406 #if !defined(OS_CHROMEOS) |
406 std::string mime_type = item->GetMimeType(); | 407 std::string mime_type = item->GetMimeType(); |
407 | 408 |
408 // If QuickOffice extension is installed, and we're not on ChromeOS,use web | 409 // If QuickOffice extension is installed, and we're not on ChromeOS,use web |
409 // intents to handle the downloaded file. | 410 // intents to handle the downloaded file. |
410 const char kQuickOfficeExtensionId[] = "gbkeegbaiigmenfmjfclcdgdpimamgkj"; | 411 const char kQuickOfficeExtensionId[] = "gbkeegbaiigmenfmjfclcdgdpimamgkj"; |
411 const char kQuickOfficeDevExtensionId[] = "ionpfmkccalenbmnddpbmocokhaknphg"; | 412 const char kQuickOfficeDevExtensionId[] = "ionpfmkccalenbmnddpbmocokhaknphg"; |
412 ExtensionServiceInterface* extension_service = | 413 ExtensionServiceInterface* extension_service = |
413 profile_->GetExtensionService(); | 414 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
414 | 415 |
415 bool use_quickoffice = false; | 416 bool use_quickoffice = false; |
416 if (extension_service && | 417 if (extension_service && |
417 extension_service->GetInstalledExtension(kQuickOfficeExtensionId) && | 418 extension_service->GetInstalledExtension(kQuickOfficeExtensionId) && |
418 extension_service->IsExtensionEnabled(kQuickOfficeExtensionId)) | 419 extension_service->IsExtensionEnabled(kQuickOfficeExtensionId)) |
419 use_quickoffice = true; | 420 use_quickoffice = true; |
420 | 421 |
421 if (extension_service && | 422 if (extension_service && |
422 extension_service->GetInstalledExtension(kQuickOfficeDevExtensionId) && | 423 extension_service->GetInstalledExtension(kQuickOfficeDevExtensionId) && |
423 extension_service->IsExtensionEnabled(kQuickOfficeDevExtensionId)) | 424 extension_service->IsExtensionEnabled(kQuickOfficeDevExtensionId)) |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 // TODO(asanka): This logic is a hack. DownloadFilePicker should give us a | 861 // TODO(asanka): This logic is a hack. DownloadFilePicker should give us a |
861 // directory to persist. Or perhaps, if the Drive path | 862 // directory to persist. Or perhaps, if the Drive path |
862 // substitution logic is moved here, then we would have a | 863 // substitution logic is moved here, then we would have a |
863 // persistable path after the DownloadFilePicker is done. | 864 // persistable path after the DownloadFilePicker is done. |
864 if (disposition == DownloadItem::TARGET_DISPOSITION_PROMPT && | 865 if (disposition == DownloadItem::TARGET_DISPOSITION_PROMPT && |
865 !download->IsTemporary()) | 866 !download->IsTemporary()) |
866 last_download_path_ = target_path.DirName(); | 867 last_download_path_ = target_path.DirName(); |
867 } | 868 } |
868 callback.Run(target_path, disposition, danger_type, intermediate_path); | 869 callback.Run(target_path, disposition, danger_type, intermediate_path); |
869 } | 870 } |
OLD | NEW |