| 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_md.h" | 5 #include "chrome/browser/ui/views/download/download_item_view_md.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> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 28 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 29 #include "chrome/browser/download/download_item_model.h" | 29 #include "chrome/browser/download/download_item_model.h" |
| 30 #include "chrome/browser/download/download_stats.h" | 30 #include "chrome/browser/download/download_stats.h" |
| 31 #include "chrome/browser/download/drag_download_item.h" | 31 #include "chrome/browser/download/drag_download_item.h" |
| 32 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" | 32 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s
ampling.h" |
| 33 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
| 34 #include "chrome/browser/safe_browsing/download_feedback_service.h" | 34 #include "chrome/browser/safe_browsing/download_feedback_service.h" |
| 35 #include "chrome/browser/safe_browsing/download_protection_service.h" | 35 #include "chrome/browser/safe_browsing/download_protection_service.h" |
| 36 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 36 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 37 #include "chrome/browser/themes/theme_properties.h" | 37 #include "chrome/browser/themes/theme_properties.h" |
| 38 #include "chrome/browser/ui/views/bar_control_button.h" | |
| 39 #include "chrome/browser/ui/views/download/download_feedback_dialog_view.h" | 38 #include "chrome/browser/ui/views/download/download_feedback_dialog_view.h" |
| 40 #include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h" | 39 #include "chrome/browser/ui/views/download/download_shelf_context_menu_view.h" |
| 41 #include "chrome/browser/ui/views/download/download_shelf_view.h" | 40 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
| 42 #include "chrome/browser/ui/views/frame/browser_view.h" | 41 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 43 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
| 44 #include "chrome/grit/generated_resources.h" | 43 #include "chrome/grit/generated_resources.h" |
| 45 #include "components/prefs/pref_service.h" | 44 #include "components/prefs/pref_service.h" |
| 46 #include "content/public/browser/download_danger_type.h" | 45 #include "content/public/browser/download_danger_type.h" |
| 47 #include "third_party/icu/source/common/unicode/uchar.h" | 46 #include "third_party/icu/source/common/unicode/uchar.h" |
| 48 #include "ui/accessibility/ax_view_state.h" | 47 #include "ui/accessibility/ax_view_state.h" |
| 49 #include "ui/base/l10n/l10n_util.h" | 48 #include "ui/base/l10n/l10n_util.h" |
| 50 #include "ui/base/material_design/material_design_controller.h" | 49 #include "ui/base/material_design/material_design_controller.h" |
| 51 #include "ui/base/resource/resource_bundle.h" | 50 #include "ui/base/resource/resource_bundle.h" |
| 52 #include "ui/base/theme_provider.h" | 51 #include "ui/base/theme_provider.h" |
| 53 #include "ui/events/event.h" | 52 #include "ui/events/event.h" |
| 54 #include "ui/gfx/animation/slide_animation.h" | 53 #include "ui/gfx/animation/slide_animation.h" |
| 55 #include "ui/gfx/canvas.h" | 54 #include "ui/gfx/canvas.h" |
| 56 #include "ui/gfx/color_palette.h" | 55 #include "ui/gfx/color_palette.h" |
| 57 #include "ui/gfx/color_utils.h" | 56 #include "ui/gfx/color_utils.h" |
| 58 #include "ui/gfx/image/image.h" | 57 #include "ui/gfx/image/image.h" |
| 59 #include "ui/gfx/paint_vector_icon.h" | 58 #include "ui/gfx/paint_vector_icon.h" |
| 60 #include "ui/gfx/text_elider.h" | 59 #include "ui/gfx/text_elider.h" |
| 61 #include "ui/gfx/text_utils.h" | 60 #include "ui/gfx/text_utils.h" |
| 62 #include "ui/gfx/vector_icons_public.h" | 61 #include "ui/gfx/vector_icons_public.h" |
| 63 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" | 62 #include "ui/views/animation/flood_fill_ink_drop_ripple.h" |
| 64 #include "ui/views/animation/ink_drop_highlight.h" | 63 #include "ui/views/animation/ink_drop_highlight.h" |
| 65 #include "ui/views/border.h" | 64 #include "ui/views/border.h" |
| 66 #include "ui/views/controls/button/image_button.h" | 65 #include "ui/views/controls/button/image_button.h" |
| 67 #include "ui/views/controls/button/md_text_button.h" | 66 #include "ui/views/controls/button/md_text_button.h" |
| 67 #include "ui/views/controls/button/vector_icon_button.h" |
| 68 #include "ui/views/controls/label.h" | 68 #include "ui/views/controls/label.h" |
| 69 #include "ui/views/mouse_constants.h" | 69 #include "ui/views/mouse_constants.h" |
| 70 #include "ui/views/widget/root_view.h" | 70 #include "ui/views/widget/root_view.h" |
| 71 #include "ui/views/widget/widget.h" | 71 #include "ui/views/widget/widget.h" |
| 72 | 72 |
| 73 using content::DownloadItem; | 73 using content::DownloadItem; |
| 74 using extensions::ExperienceSamplingEvent; | 74 using extensions::ExperienceSamplingEvent; |
| 75 | 75 |
| 76 namespace { | 76 namespace { |
| 77 | 77 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 146 |
| 147 private: | 147 private: |
| 148 SkColor color_; | 148 SkColor color_; |
| 149 | 149 |
| 150 DISALLOW_COPY_AND_ASSIGN(SeparatorBorder); | 150 DISALLOW_COPY_AND_ASSIGN(SeparatorBorder); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 } // namespace | 153 } // namespace |
| 154 | 154 |
| 155 // Allows the DownloadItemViewMd to control the InkDrop on the drop down button. | 155 // Allows the DownloadItemViewMd to control the InkDrop on the drop down button. |
| 156 class DownloadItemViewMd::DropDownButton : public BarControlButton { | 156 class DownloadItemViewMd::DropDownButton : public views::VectorIconButton { |
| 157 public: | 157 public: |
| 158 explicit DropDownButton(views::ButtonListener* listener) | 158 explicit DropDownButton(views::ButtonListener* listener) |
| 159 : BarControlButton(listener) {} | 159 : views::VectorIconButton(listener) {} |
| 160 ~DropDownButton() override {} | 160 ~DropDownButton() override {} |
| 161 | 161 |
| 162 // Promoted visibility to public. | 162 // Promoted visibility to public. |
| 163 void AnimateInkDrop(views::InkDropState state) { | 163 void AnimateInkDrop(views::InkDropState state) { |
| 164 // TODO(bruthig): Plumb in the proper Event. | 164 // TODO(bruthig): Plumb in the proper Event. |
| 165 BarControlButton::AnimateInkDrop(state, nullptr /* event */); | 165 views::VectorIconButton::AnimateInkDrop(state, nullptr /* event */); |
| 166 } | 166 } |
| 167 | 167 |
| 168 private: | 168 private: |
| 169 DISALLOW_COPY_AND_ASSIGN(DropDownButton); | 169 DISALLOW_COPY_AND_ASSIGN(DropDownButton); |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 DownloadItemViewMd::DownloadItemViewMd(DownloadItem* download_item, | 172 DownloadItemViewMd::DownloadItemViewMd(DownloadItem* download_item, |
| 173 DownloadShelfView* parent) | 173 DownloadShelfView* parent) |
| 174 : shelf_(parent), | 174 : shelf_(parent), |
| 175 status_text_(l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING)), | 175 status_text_(l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING)), |
| (...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 SchedulePaint(); | 1120 SchedulePaint(); |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 SkColor DownloadItemViewMd::GetTextColor() const { | 1123 SkColor DownloadItemViewMd::GetTextColor() const { |
| 1124 return GetTextColorForThemeProvider(GetThemeProvider()); | 1124 return GetTextColorForThemeProvider(GetThemeProvider()); |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 SkColor DownloadItemViewMd::GetDimmedTextColor() const { | 1127 SkColor DownloadItemViewMd::GetDimmedTextColor() const { |
| 1128 return SkColorSetA(GetTextColor(), 0xC7); | 1128 return SkColorSetA(GetTextColor(), 0xC7); |
| 1129 } | 1129 } |
| OLD | NEW |