OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/location_bar/bubble_icon_view.h" | 5 #include "chrome/browser/ui/views/location_bar/bubble_icon_view.h" |
6 | 6 |
7 #include "chrome/browser/command_updater.h" | 7 #include "chrome/browser/command_updater.h" |
8 #include "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
9 #include "ui/base/material_design/material_design_controller.h" | 9 #include "ui/base/material_design/material_design_controller.h" |
10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
11 #include "ui/gfx/color_palette.h" | 11 #include "ui/gfx/color_palette.h" |
12 #include "ui/gfx/color_utils.h" | 12 #include "ui/gfx/color_utils.h" |
13 #include "ui/gfx/paint_vector_icon.h" | 13 #include "ui/gfx/paint_vector_icon.h" |
14 #include "ui/native_theme/native_theme.h" | 14 #include "ui/native_theme/native_theme.h" |
15 #include "ui/views/animation/ink_drop_highlight.h" | 15 #include "ui/views/animation/ink_drop_highlight.h" |
16 #include "ui/views/bubble/bubble_dialog_delegate.h" | 16 #include "ui/views/bubble/bubble_dialog_delegate.h" |
17 | 17 |
18 BubbleIconView::BubbleIconView(CommandUpdater* command_updater, int command_id) | 18 BubbleIconView::BubbleIconView(CommandUpdater* command_updater, int command_id) |
19 : image_(new views::ImageView()), | 19 : image_(new views::ImageView()), |
20 command_updater_(command_updater), | 20 command_updater_(command_updater), |
21 command_id_(command_id), | 21 command_id_(command_id), |
22 active_(false), | 22 active_(false), |
23 suppress_mouse_released_action_(false) { | 23 suppress_mouse_released_action_(false) { |
24 AddChildView(image_); | 24 AddChildView(image_); |
25 image_->set_interactive(false); | 25 image_->set_interactive(false); |
26 image_->EnableCanvasFlippingForRTLUI(true); | 26 image_->EnableCanvasFlippingForRTLUI(true); |
27 if (ui::MaterialDesignController::IsModeMaterial()) { | 27 if (ui::MaterialDesignController::IsModeMaterial()) { |
28 SetHasInkDrop(true); | 28 SetInkDropMode(InkDropMode::ON); |
29 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); | 29 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); |
30 } else { | 30 } else { |
31 image_->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); | 31 image_->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 BubbleIconView::~BubbleIconView() {} | 35 BubbleIconView::~BubbleIconView() {} |
36 | 36 |
37 bool BubbleIconView::IsBubbleShowing() const { | 37 bool BubbleIconView::IsBubbleShowing() const { |
38 // If the bubble is being destroyed, it's considered showing though it may be | 38 // If the bubble is being destroyed, it's considered showing though it may be |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 image_->SetImage( | 207 image_->SetImage( |
208 gfx::CreateVectorIcon(GetVectorIcon(), icon_size, icon_color)); | 208 gfx::CreateVectorIcon(GetVectorIcon(), icon_size, icon_color)); |
209 } | 209 } |
210 | 210 |
211 void BubbleIconView::SetActiveInternal(bool active) { | 211 void BubbleIconView::SetActiveInternal(bool active) { |
212 if (active_ == active) | 212 if (active_ == active) |
213 return; | 213 return; |
214 active_ = active; | 214 active_ = active; |
215 UpdateIcon(); | 215 UpdateIcon(); |
216 } | 216 } |
OLD | NEW |