| 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/common/chrome_notification_types.h" | 40 #include "chrome/common/chrome_notification_types.h" |
| 40 #include "chrome/common/extensions/feature_switch.h" | 41 #include "chrome/common/extensions/feature_switch.h" |
| 41 #include "chrome/common/extensions/user_script.h" | 42 #include "chrome/common/extensions/user_script.h" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 return false; | 402 return false; |
| 402 | 403 |
| 403 #if !defined(OS_CHROMEOS) | 404 #if !defined(OS_CHROMEOS) |
| 404 std::string mime_type = item->GetMimeType(); | 405 std::string mime_type = item->GetMimeType(); |
| 405 | 406 |
| 406 // If QuickOffice extension is installed, and we're not on ChromeOS,use web | 407 // If QuickOffice extension is installed, and we're not on ChromeOS,use web |
| 407 // intents to handle the downloaded file. | 408 // intents to handle the downloaded file. |
| 408 const char kQuickOfficeExtensionId[] = "gbkeegbaiigmenfmjfclcdgdpimamgkj"; | 409 const char kQuickOfficeExtensionId[] = "gbkeegbaiigmenfmjfclcdgdpimamgkj"; |
| 409 const char kQuickOfficeDevExtensionId[] = "ionpfmkccalenbmnddpbmocokhaknphg"; | 410 const char kQuickOfficeDevExtensionId[] = "ionpfmkccalenbmnddpbmocokhaknphg"; |
| 410 ExtensionServiceInterface* extension_service = | 411 ExtensionServiceInterface* extension_service = |
| 411 profile_->GetExtensionService(); | 412 extensions::ExtensionSystem::Get(profile_)->extension_service(); |
| 412 | 413 |
| 413 bool use_quickoffice = false; | 414 bool use_quickoffice = false; |
| 414 if (extension_service && | 415 if (extension_service && |
| 415 extension_service->GetInstalledExtension(kQuickOfficeExtensionId) && | 416 extension_service->GetInstalledExtension(kQuickOfficeExtensionId) && |
| 416 extension_service->IsExtensionEnabled(kQuickOfficeExtensionId)) | 417 extension_service->IsExtensionEnabled(kQuickOfficeExtensionId)) |
| 417 use_quickoffice = true; | 418 use_quickoffice = true; |
| 418 | 419 |
| 419 if (extension_service && | 420 if (extension_service && |
| 420 extension_service->GetInstalledExtension(kQuickOfficeDevExtensionId) && | 421 extension_service->GetInstalledExtension(kQuickOfficeDevExtensionId) && |
| 421 extension_service->IsExtensionEnabled(kQuickOfficeDevExtensionId)) | 422 extension_service->IsExtensionEnabled(kQuickOfficeDevExtensionId)) |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 // TODO(asanka): This logic is a hack. DownloadFilePicker should give us a | 859 // TODO(asanka): This logic is a hack. DownloadFilePicker should give us a |
| 859 // directory to persist. Or perhaps, if the Drive path | 860 // directory to persist. Or perhaps, if the Drive path |
| 860 // substitution logic is moved here, then we would have a | 861 // substitution logic is moved here, then we would have a |
| 861 // persistable path after the DownloadFilePicker is done. | 862 // persistable path after the DownloadFilePicker is done. |
| 862 if (disposition == DownloadItem::TARGET_DISPOSITION_PROMPT && | 863 if (disposition == DownloadItem::TARGET_DISPOSITION_PROMPT && |
| 863 !download->IsTemporary()) | 864 !download->IsTemporary()) |
| 864 last_download_path_ = target_path.DirName(); | 865 last_download_path_ = target_path.DirName(); |
| 865 } | 866 } |
| 866 callback.Run(target_path, disposition, danger_type, intermediate_path); | 867 callback.Run(target_path, disposition, danger_type, intermediate_path); |
| 867 } | 868 } |
| OLD | NEW |