| 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 "chrome/browser/ui/views/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 9 #include "ui/accessibility/ax_node_data.h" | 9 #include "ui/accessibility/ax_node_data.h" |
| 10 #include "ui/compositor/layer_type.h" |
| 10 #include "ui/events/event.h" | 11 #include "ui/events/event.h" |
| 11 #include "ui/gfx/color_utils.h" | 12 #include "ui/gfx/color_utils.h" |
| 12 #include "ui/gfx/paint_vector_icon.h" | 13 #include "ui/gfx/paint_vector_icon.h" |
| 13 #include "ui/native_theme/native_theme.h" | 14 #include "ui/native_theme/native_theme.h" |
| 14 #include "ui/views/animation/ink_drop_highlight.h" | 15 #include "ui/views/animation/ink_drop_highlight.h" |
| 15 #include "ui/views/animation/ink_drop_impl.h" | 16 #include "ui/views/animation/ink_drop_impl.h" |
| 16 #include "ui/views/bubble/bubble_dialog_delegate.h" | 17 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 17 | 18 |
| 18 BubbleIconView::BubbleIconView(CommandUpdater* command_updater, int command_id) | 19 BubbleIconView::BubbleIconView(CommandUpdater* command_updater, int command_id) |
| 19 : image_(new views::ImageView()), | 20 : image_(new views::ImageView()), |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 View::ViewHierarchyChanged(details); | 125 View::ViewHierarchyChanged(details); |
| 125 if (details.is_add && GetNativeTheme()) | 126 if (details.is_add && GetNativeTheme()) |
| 126 UpdateIcon(); | 127 UpdateIcon(); |
| 127 } | 128 } |
| 128 | 129 |
| 129 void BubbleIconView::OnNativeThemeChanged(const ui::NativeTheme* theme) { | 130 void BubbleIconView::OnNativeThemeChanged(const ui::NativeTheme* theme) { |
| 130 UpdateIcon(); | 131 UpdateIcon(); |
| 131 } | 132 } |
| 132 | 133 |
| 133 void BubbleIconView::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 134 void BubbleIconView::AddInkDropLayer(ui::Layer* ink_drop_layer) { |
| 134 image_->SetPaintToLayer(true); | 135 image_->SetPaintToLayer(ui::LAYER_TEXTURED); |
| 135 image_->layer()->SetFillsBoundsOpaquely(false); | 136 image_->layer()->SetFillsBoundsOpaquely(false); |
| 136 views::InkDropHostView::AddInkDropLayer(ink_drop_layer); | 137 views::InkDropHostView::AddInkDropLayer(ink_drop_layer); |
| 137 } | 138 } |
| 138 | 139 |
| 139 void BubbleIconView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 140 void BubbleIconView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
| 140 views::InkDropHostView::RemoveInkDropLayer(ink_drop_layer); | 141 views::InkDropHostView::RemoveInkDropLayer(ink_drop_layer); |
| 141 image_->SetPaintToLayer(false); | 142 image_->SetPaintToLayer(ui::LAYER_NOT_DRAWN); |
| 142 } | 143 } |
| 143 | 144 |
| 144 std::unique_ptr<views::InkDrop> BubbleIconView::CreateInkDrop() { | 145 std::unique_ptr<views::InkDrop> BubbleIconView::CreateInkDrop() { |
| 145 std::unique_ptr<views::InkDropImpl> ink_drop = CreateDefaultInkDropImpl(); | 146 std::unique_ptr<views::InkDropImpl> ink_drop = CreateDefaultInkDropImpl(); |
| 146 ink_drop->SetShowHighlightOnFocus(true); | 147 ink_drop->SetShowHighlightOnFocus(true); |
| 147 return std::move(ink_drop); | 148 return std::move(ink_drop); |
| 148 } | 149 } |
| 149 | 150 |
| 150 SkColor BubbleIconView::GetInkDropBaseColor() const { | 151 SkColor BubbleIconView::GetInkDropBaseColor() const { |
| 151 return color_utils::DeriveDefaultIconColor(GetNativeTheme()->GetSystemColor( | 152 return color_utils::DeriveDefaultIconColor(GetNativeTheme()->GetSystemColor( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 image_->SetImage(gfx::CreateVectorIcon( | 198 image_->SetImage(gfx::CreateVectorIcon( |
| 198 GetVectorIcon(), LocationBarView::kIconWidth, icon_color)); | 199 GetVectorIcon(), LocationBarView::kIconWidth, icon_color)); |
| 199 } | 200 } |
| 200 | 201 |
| 201 void BubbleIconView::SetActiveInternal(bool active) { | 202 void BubbleIconView::SetActiveInternal(bool active) { |
| 202 if (active_ == active) | 203 if (active_ == active) |
| 203 return; | 204 return; |
| 204 active_ = active; | 205 active_ = active; |
| 205 UpdateIcon(); | 206 UpdateIcon(); |
| 206 } | 207 } |
| OLD | NEW |