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/events/event.h" | 10 #include "ui/events/event.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 View::ViewHierarchyChanged(details); | 124 View::ViewHierarchyChanged(details); |
125 if (details.is_add && GetNativeTheme()) | 125 if (details.is_add && GetNativeTheme()) |
126 UpdateIcon(); | 126 UpdateIcon(); |
127 } | 127 } |
128 | 128 |
129 void BubbleIconView::OnNativeThemeChanged(const ui::NativeTheme* theme) { | 129 void BubbleIconView::OnNativeThemeChanged(const ui::NativeTheme* theme) { |
130 UpdateIcon(); | 130 UpdateIcon(); |
131 } | 131 } |
132 | 132 |
133 void BubbleIconView::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 133 void BubbleIconView::AddInkDropLayer(ui::Layer* ink_drop_layer) { |
134 image_->SetPaintToLayer(true); | 134 image_->SetPaintToLayer(); |
135 image_->layer()->SetFillsBoundsOpaquely(false); | 135 image_->layer()->SetFillsBoundsOpaquely(false); |
136 views::InkDropHostView::AddInkDropLayer(ink_drop_layer); | 136 views::InkDropHostView::AddInkDropLayer(ink_drop_layer); |
137 } | 137 } |
138 | 138 |
139 void BubbleIconView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 139 void BubbleIconView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
140 views::InkDropHostView::RemoveInkDropLayer(ink_drop_layer); | 140 views::InkDropHostView::RemoveInkDropLayer(ink_drop_layer); |
141 image_->SetPaintToLayer(false); | 141 image_->DestroyLayer(); |
142 } | 142 } |
143 | 143 |
144 std::unique_ptr<views::InkDrop> BubbleIconView::CreateInkDrop() { | 144 std::unique_ptr<views::InkDrop> BubbleIconView::CreateInkDrop() { |
145 std::unique_ptr<views::InkDropImpl> ink_drop = CreateDefaultInkDropImpl(); | 145 std::unique_ptr<views::InkDropImpl> ink_drop = CreateDefaultInkDropImpl(); |
146 ink_drop->SetShowHighlightOnFocus(true); | 146 ink_drop->SetShowHighlightOnFocus(true); |
147 return std::move(ink_drop); | 147 return std::move(ink_drop); |
148 } | 148 } |
149 | 149 |
150 SkColor BubbleIconView::GetInkDropBaseColor() const { | 150 SkColor BubbleIconView::GetInkDropBaseColor() const { |
151 return color_utils::DeriveDefaultIconColor(GetNativeTheme()->GetSystemColor( | 151 return color_utils::DeriveDefaultIconColor(GetNativeTheme()->GetSystemColor( |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 image_->SetImage(gfx::CreateVectorIcon( | 197 image_->SetImage(gfx::CreateVectorIcon( |
198 GetVectorIcon(), LocationBarView::kIconWidth, icon_color)); | 198 GetVectorIcon(), LocationBarView::kIconWidth, icon_color)); |
199 } | 199 } |
200 | 200 |
201 void BubbleIconView::SetActiveInternal(bool active) { | 201 void BubbleIconView::SetActiveInternal(bool active) { |
202 if (active_ == active) | 202 if (active_ == active) |
203 return; | 203 return; |
204 active_ = active; | 204 active_ = active; |
205 UpdateIcon(); | 205 UpdateIcon(); |
206 } | 206 } |
OLD | NEW |