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/button_ink_drop_delegate.h" | 15 #include "ui/views/animation/button_ink_drop_delegate.h" |
16 #include "ui/views/animation/ink_drop_hover.h" | 16 #include "ui/views/animation/ink_drop_highlight.h" |
17 #include "ui/views/bubble/bubble_dialog_delegate.h" | 17 #include "ui/views/bubble/bubble_dialog_delegate.h" |
18 | 18 |
19 BubbleIconView::BubbleIconView(CommandUpdater* command_updater, int command_id) | 19 BubbleIconView::BubbleIconView(CommandUpdater* command_updater, int command_id) |
20 : image_(new views::ImageView()), | 20 : image_(new views::ImageView()), |
21 command_updater_(command_updater), | 21 command_updater_(command_updater), |
22 command_id_(command_id), | 22 command_id_(command_id), |
23 active_(false), | 23 active_(false), |
24 suppress_mouse_released_action_(false) { | 24 suppress_mouse_released_action_(false) { |
25 AddChildView(image_); | 25 AddChildView(image_); |
26 image_->set_interactive(false); | 26 image_->set_interactive(false); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 image_->SetPaintToLayer(true); | 139 image_->SetPaintToLayer(true); |
140 image_->layer()->SetFillsBoundsOpaquely(false); | 140 image_->layer()->SetFillsBoundsOpaquely(false); |
141 views::InkDropHostView::AddInkDropLayer(ink_drop_layer); | 141 views::InkDropHostView::AddInkDropLayer(ink_drop_layer); |
142 } | 142 } |
143 | 143 |
144 void BubbleIconView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 144 void BubbleIconView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
145 views::InkDropHostView::RemoveInkDropLayer(ink_drop_layer); | 145 views::InkDropHostView::RemoveInkDropLayer(ink_drop_layer); |
146 image_->SetPaintToLayer(false); | 146 image_->SetPaintToLayer(false); |
147 } | 147 } |
148 | 148 |
149 std::unique_ptr<views::InkDropHover> BubbleIconView::CreateInkDropHover() | 149 std::unique_ptr<views::InkDropHighlight> |
150 const { | 150 BubbleIconView::CreateInkDropHighlight() const { |
151 // BubbleIconView views don't show hover effect. | 151 // BubbleIconView views don't show hover effect. |
152 return HasFocus() ? InkDropHostView::CreateInkDropHover() : nullptr; | 152 return HasFocus() ? InkDropHostView::CreateInkDropHighlight() : nullptr; |
153 } | 153 } |
154 | 154 |
155 SkColor BubbleIconView::GetInkDropBaseColor() const { | 155 SkColor BubbleIconView::GetInkDropBaseColor() const { |
156 return color_utils::DeriveDefaultIconColor(GetNativeTheme()->GetSystemColor( | 156 return color_utils::DeriveDefaultIconColor(GetNativeTheme()->GetSystemColor( |
157 ui::NativeTheme::kColorId_TextfieldDefaultColor)); | 157 ui::NativeTheme::kColorId_TextfieldDefaultColor)); |
158 } | 158 } |
159 | 159 |
160 bool BubbleIconView::ShouldShowInkDropForFocus() const { | 160 bool BubbleIconView::ShouldShowInkDropForFocus() const { |
161 return true; | 161 return true; |
162 } | 162 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 image_->SetImage( | 214 image_->SetImage( |
215 gfx::CreateVectorIcon(GetVectorIcon(), icon_size, icon_color)); | 215 gfx::CreateVectorIcon(GetVectorIcon(), icon_size, icon_color)); |
216 } | 216 } |
217 | 217 |
218 void BubbleIconView::SetActiveInternal(bool active) { | 218 void BubbleIconView::SetActiveInternal(bool active) { |
219 if (active_ == active) | 219 if (active_ == active) |
220 return; | 220 return; |
221 active_ = active; | 221 active_ = active; |
222 UpdateIcon(); | 222 UpdateIcon(); |
223 } | 223 } |
OLD | NEW |