| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Download utility implementation | 5 // Download utility implementation |
| 6 | 6 |
| 7 #include "chrome/browser/download/download_util.h" | 7 #include "chrome/browser/download/download_util.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <shobjidl.h> | 10 #include <shobjidl.h> |
| 11 #endif | 11 #endif |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "app/l10n_util.h" | 14 #include "app/l10n_util.h" |
| 15 #include "app/resource_bundle.h" | 15 #include "app/resource_bundle.h" |
| 16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 17 #include "base/i18n/rtl.h" | 17 #include "base/i18n/rtl.h" |
| 18 #include "base/i18n/time_formatting.h" | 18 #include "base/i18n/time_formatting.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/singleton.h" | 20 #include "base/singleton.h" |
| 21 #include "base/string16.h" | 21 #include "base/string16.h" |
| 22 #include "base/string_number_conversions.h" | 22 #include "base/string_number_conversions.h" |
| 23 #include "base/sys_string_conversions.h" | 23 #include "base/sys_string_conversions.h" |
| 24 #include "base/utf_string_conversions.h" | 24 #include "base/utf_string_conversions.h" |
| 25 #include "base/values.h" | 25 #include "base/values.h" |
| 26 #include "base/win/windows_version.h" |
| 26 #include "chrome/browser/browser.h" | 27 #include "chrome/browser/browser.h" |
| 27 #include "chrome/browser/browser_list.h" | 28 #include "chrome/browser/browser_list.h" |
| 28 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
| 29 #include "chrome/browser/browser_thread.h" | 30 #include "chrome/browser/browser_thread.h" |
| 30 #include "chrome/browser/download/download_item.h" | 31 #include "chrome/browser/download/download_item.h" |
| 31 #include "chrome/browser/download/download_item_model.h" | 32 #include "chrome/browser/download/download_item_model.h" |
| 32 #include "chrome/browser/download/download_manager.h" | 33 #include "chrome/browser/download/download_manager.h" |
| 33 #include "chrome/browser/extensions/crx_installer.h" | 34 #include "chrome/browser/extensions/crx_installer.h" |
| 34 #include "chrome/browser/extensions/extension_install_ui.h" | 35 #include "chrome/browser/extensions/extension_install_ui.h" |
| 35 #include "chrome/browser/extensions/extensions_service.h" | 36 #include "chrome/browser/extensions/extensions_service.h" |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, speed_text, | 592 return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, speed_text, |
| 592 amount, UTF16ToWideHack(time_remaining)); | 593 amount, UTF16ToWideHack(time_remaining)); |
| 593 } | 594 } |
| 594 | 595 |
| 595 #if !defined(OS_MACOSX) | 596 #if !defined(OS_MACOSX) |
| 596 void UpdateAppIconDownloadProgress(int download_count, | 597 void UpdateAppIconDownloadProgress(int download_count, |
| 597 bool progress_known, | 598 bool progress_known, |
| 598 float progress) { | 599 float progress) { |
| 599 #if defined(OS_WIN) | 600 #if defined(OS_WIN) |
| 600 // Taskbar progress bar is only supported on Win7. | 601 // Taskbar progress bar is only supported on Win7. |
| 601 if (win_util::GetWinVersion() < win_util::WINVERSION_WIN7) | 602 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
| 602 return; | 603 return; |
| 603 | 604 |
| 604 ScopedComPtr<ITaskbarList3> taskbar; | 605 ScopedComPtr<ITaskbarList3> taskbar; |
| 605 HRESULT result = taskbar.CreateInstance(CLSID_TaskbarList, NULL, | 606 HRESULT result = taskbar.CreateInstance(CLSID_TaskbarList, NULL, |
| 606 CLSCTX_INPROC_SERVER); | 607 CLSCTX_INPROC_SERVER); |
| 607 if (FAILED(result)) { | 608 if (FAILED(result)) { |
| 608 LOG(INFO) << "failed creating a TaskbarList object: " << result; | 609 LOG(INFO) << "failed creating a TaskbarList object: " << result; |
| 609 return; | 610 return; |
| 610 } | 611 } |
| 611 | 612 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 ExtensionsService* service = profile->GetExtensionsService(); | 726 ExtensionsService* service = profile->GetExtensionsService(); |
| 726 if (!service || | 727 if (!service || |
| 727 !service->IsDownloadFromGallery(info->url, info->referrer_url)) { | 728 !service->IsDownloadFromGallery(info->url, info->referrer_url)) { |
| 728 return true; | 729 return true; |
| 729 } | 730 } |
| 730 } | 731 } |
| 731 return false; | 732 return false; |
| 732 } | 733 } |
| 733 | 734 |
| 734 } // namespace download_util | 735 } // namespace download_util |
| OLD | NEW |