Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 #include "ui/base/dragdrop/os_exchange_data.h" | 63 #include "ui/base/dragdrop/os_exchange_data.h" |
| 64 #include "views/drag_utils.h" | 64 #include "views/drag_utils.h" |
| 65 #endif | 65 #endif |
| 66 | 66 |
| 67 #if defined(TOOLKIT_USES_GTK) | 67 #if defined(TOOLKIT_USES_GTK) |
| 68 #if defined(TOOLKIT_VIEWS) | 68 #if defined(TOOLKIT_VIEWS) |
| 69 #include "ui/base/dragdrop/drag_drop_types.h" | 69 #include "ui/base/dragdrop/drag_drop_types.h" |
| 70 #include "views/widget/widget_gtk.h" | 70 #include "views/widget/widget_gtk.h" |
| 71 #elif defined(TOOLKIT_GTK) | 71 #elif defined(TOOLKIT_GTK) |
| 72 #include "chrome/browser/ui/gtk/custom_drag.h" | 72 #include "chrome/browser/ui/gtk/custom_drag.h" |
| 73 #include "chrome/browser/ui/gtk/dock_service.h" | |
| 73 #endif // defined(TOOLKIT_GTK) | 74 #endif // defined(TOOLKIT_GTK) |
| 74 #endif // defined(TOOLKIT_USES_GTK) | 75 #endif // defined(TOOLKIT_USES_GTK) |
| 75 | 76 |
| 76 #if defined(OS_WIN) | 77 #if defined(OS_WIN) |
| 77 #include "base/win/scoped_comptr.h" | 78 #include "base/win/scoped_comptr.h" |
| 78 #include "chrome/browser/ui/browser_list.h" | 79 #include "chrome/browser/ui/browser_list.h" |
| 79 #include "chrome/browser/ui/views/frame/browser_view.h" | 80 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 80 #include "ui/base/dragdrop/drag_source.h" | 81 #include "ui/base/dragdrop/drag_source.h" |
| 81 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 82 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
| 82 #endif | 83 #endif |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 749 if (!window) | 750 if (!window) |
| 750 continue; | 751 continue; |
| 751 HWND frame = window->GetNativeHandle(); | 752 HWND frame = window->GetNativeHandle(); |
| 752 if (download_count == 0 || progress == 1.0f) | 753 if (download_count == 0 || progress == 1.0f) |
| 753 taskbar->SetProgressState(frame, TBPF_NOPROGRESS); | 754 taskbar->SetProgressState(frame, TBPF_NOPROGRESS); |
| 754 else if (!progress_known) | 755 else if (!progress_known) |
| 755 taskbar->SetProgressState(frame, TBPF_INDETERMINATE); | 756 taskbar->SetProgressState(frame, TBPF_INDETERMINATE); |
| 756 else | 757 else |
| 757 taskbar->SetProgressValue(frame, static_cast<int>(progress * 100), 100); | 758 taskbar->SetProgressValue(frame, static_cast<int>(progress * 100), 100); |
| 758 } | 759 } |
| 760 #elif defined(TOOLKIT_GTK) | |
| 761 DockService* service = DockService::GetService(); | |
|
Evan Martin
2011/04/26 00:33:52
This appears to make blocking disk calls. Do we c
Elliot Glaysher
2011/04/26 01:02:39
I'm not sure. The dlsym parts (I think) can be run
| |
| 762 if (service) { | |
| 763 service->SetDownloadCount(download_count); | |
| 764 service->SetProgressPercent(progress); | |
| 765 } | |
| 759 #endif | 766 #endif |
| 760 } | 767 } |
| 761 #endif | 768 #endif |
| 762 | 769 |
| 763 // Appends the passed the number between parenthesis the path before the | 770 // Appends the passed the number between parenthesis the path before the |
| 764 // extension. | 771 // extension. |
| 765 void AppendNumberToPath(FilePath* path, int number) { | 772 void AppendNumberToPath(FilePath* path, int number) { |
| 766 *path = path->InsertBeforeExtensionASCII(StringPrintf(" (%d)", number)); | 773 *path = path->InsertBeforeExtensionASCII(StringPrintf(" (%d)", number)); |
| 767 } | 774 } |
| 768 | 775 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 890 // Extensions that are not from the gallery are considered dangerous. | 897 // Extensions that are not from the gallery are considered dangerous. |
| 891 ExtensionService* service = profile->GetExtensionService(); | 898 ExtensionService* service = profile->GetExtensionService(); |
| 892 if (!service || | 899 if (!service || |
| 893 !service->IsDownloadFromGallery(info->url(), info->referrer_url)) | 900 !service->IsDownloadFromGallery(info->url(), info->referrer_url)) |
| 894 return true; | 901 return true; |
| 895 } | 902 } |
| 896 return false; | 903 return false; |
| 897 } | 904 } |
| 898 | 905 |
| 899 } // namespace download_util | 906 } // namespace download_util |
| OLD | NEW |