| 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/ui/views/download/download_item_view.h" | 5 #include "chrome/browser/ui/views/download/download_item_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/i18n/break_iterator.h" | 15 #include "base/i18n/break_iterator.h" |
| 16 #include "base/i18n/rtl.h" | 16 #include "base/i18n/rtl.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
| 19 #include "base/metrics/histogram_macros.h" | 19 #include "base/metrics/histogram_macros.h" |
| 20 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
| 21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
| 22 #include "base/strings/sys_string_conversions.h" | 22 #include "base/strings/sys_string_conversions.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/threading/thread_task_runner_handle.h" | 24 #include "base/threading/thread_task_runner_handle.h" |
| 25 #include "chrome/app/vector_icons/vector_icons.h" |
| 25 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 26 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 27 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 27 #include "chrome/browser/download/download_item_model.h" | 28 #include "chrome/browser/download/download_item_model.h" |
| 28 #include "chrome/browser/download/download_stats.h" | 29 #include "chrome/browser/download/download_stats.h" |
| 29 #include "chrome/browser/download/drag_download_item.h" | 30 #include "chrome/browser/download/drag_download_item.h" |
| 30 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" | 31 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" |
| 31 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
| 32 #include "chrome/browser/safe_browsing/download_feedback_service.h" | 33 #include "chrome/browser/safe_browsing/download_feedback_service.h" |
| 33 #include "chrome/browser/safe_browsing/download_protection_service.h" | 34 #include "chrome/browser/safe_browsing/download_protection_service.h" |
| 34 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 35 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 OpenDownload(); | 875 OpenDownload(); |
| 875 } | 876 } |
| 876 | 877 |
| 877 void DownloadItemView::SetDropdownState(State new_state) { | 878 void DownloadItemView::SetDropdownState(State new_state) { |
| 878 // Avoid extra SchedulePaint()s if the state is going to be the same and | 879 // Avoid extra SchedulePaint()s if the state is going to be the same and |
| 879 // |dropdown_button_| has already been initialized. | 880 // |dropdown_button_| has already been initialized. |
| 880 if (dropdown_state_ == new_state && | 881 if (dropdown_state_ == new_state && |
| 881 !dropdown_button_->GetImage(views::CustomButton::STATE_NORMAL).isNull()) | 882 !dropdown_button_->GetImage(views::CustomButton::STATE_NORMAL).isNull()) |
| 882 return; | 883 return; |
| 883 | 884 |
| 884 dropdown_button_->SetIcon(new_state == PUSHED ? gfx::VectorIconId::FIND_NEXT | 885 dropdown_button_->SetIcon(new_state == PUSHED ? kCaretDownIcon |
| 885 : gfx::VectorIconId::FIND_PREV); | 886 : kCaretUpIcon); |
| 886 if (new_state != dropdown_state_) { | 887 if (new_state != dropdown_state_) { |
| 887 dropdown_button_->AnimateInkDrop(new_state == PUSHED | 888 dropdown_button_->AnimateInkDrop(new_state == PUSHED |
| 888 ? views::InkDropState::ACTIVATED | 889 ? views::InkDropState::ACTIVATED |
| 889 : views::InkDropState::DEACTIVATED); | 890 : views::InkDropState::DEACTIVATED); |
| 890 } | 891 } |
| 891 dropdown_button_->OnThemeChanged(); | 892 dropdown_button_->OnThemeChanged(); |
| 892 dropdown_state_ = new_state; | 893 dropdown_state_ = new_state; |
| 893 SchedulePaint(); | 894 SchedulePaint(); |
| 894 } | 895 } |
| 895 | 896 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 SchedulePaint(); | 1124 SchedulePaint(); |
| 1124 } | 1125 } |
| 1125 | 1126 |
| 1126 SkColor DownloadItemView::GetTextColor() const { | 1127 SkColor DownloadItemView::GetTextColor() const { |
| 1127 return GetTextColorForThemeProvider(GetThemeProvider()); | 1128 return GetTextColorForThemeProvider(GetThemeProvider()); |
| 1128 } | 1129 } |
| 1129 | 1130 |
| 1130 SkColor DownloadItemView::GetDimmedTextColor() const { | 1131 SkColor DownloadItemView::GetDimmedTextColor() const { |
| 1131 return SkColorSetA(GetTextColor(), 0xC7); | 1132 return SkColorSetA(GetTextColor(), 0xC7); |
| 1132 } | 1133 } |
| OLD | NEW |