| 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/unity_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 unity::SetDownloadCount(download_count); |
| 762 unity::SetProgressFraction(progress); |
| 759 #endif | 763 #endif |
| 760 } | 764 } |
| 761 #endif | 765 #endif |
| 762 | 766 |
| 763 // Appends the passed the number between parenthesis the path before the | 767 // Appends the passed the number between parenthesis the path before the |
| 764 // extension. | 768 // extension. |
| 765 void AppendNumberToPath(FilePath* path, int number) { | 769 void AppendNumberToPath(FilePath* path, int number) { |
| 766 *path = path->InsertBeforeExtensionASCII(StringPrintf(" (%d)", number)); | 770 *path = path->InsertBeforeExtensionASCII(StringPrintf(" (%d)", number)); |
| 767 } | 771 } |
| 768 | 772 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 // Extensions that are not from the gallery are considered dangerous. | 894 // Extensions that are not from the gallery are considered dangerous. |
| 891 ExtensionService* service = profile->GetExtensionService(); | 895 ExtensionService* service = profile->GetExtensionService(); |
| 892 if (!service || | 896 if (!service || |
| 893 !service->IsDownloadFromGallery(info->url(), info->referrer_url)) | 897 !service->IsDownloadFromGallery(info->url(), info->referrer_url)) |
| 894 return true; | 898 return true; |
| 895 } | 899 } |
| 896 return false; | 900 return false; |
| 897 } | 901 } |
| 898 | 902 |
| 899 } // namespace download_util | 903 } // namespace download_util |
| OLD | NEW |