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/location_bar/icon_label_bubble_view.h" | 5 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" |
6 | 6 |
7 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 7 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
8 #include "ui/accessibility/ax_node_data.h" | 8 #include "ui/accessibility/ax_node_data.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/gfx/color_utils.h" | 10 #include "ui/gfx/color_utils.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 | 137 |
138 void IconLabelBubbleView::OnNativeThemeChanged( | 138 void IconLabelBubbleView::OnNativeThemeChanged( |
139 const ui::NativeTheme* native_theme) { | 139 const ui::NativeTheme* native_theme) { |
140 label_->SetEnabledColor(GetTextColor()); | 140 label_->SetEnabledColor(GetTextColor()); |
141 label_->SetBackgroundColor(GetParentBackgroundColor()); | 141 label_->SetBackgroundColor(GetParentBackgroundColor()); |
142 SchedulePaint(); | 142 SchedulePaint(); |
143 } | 143 } |
144 | 144 |
145 void IconLabelBubbleView::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 145 void IconLabelBubbleView::AddInkDropLayer(ui::Layer* ink_drop_layer) { |
146 image()->SetPaintToLayer(true); | 146 image()->SetPaintToLayer(); |
147 image()->layer()->SetFillsBoundsOpaquely(false); | 147 image()->layer()->SetFillsBoundsOpaquely(false); |
148 InkDropHostView::AddInkDropLayer(ink_drop_layer); | 148 InkDropHostView::AddInkDropLayer(ink_drop_layer); |
149 } | 149 } |
150 | 150 |
151 void IconLabelBubbleView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 151 void IconLabelBubbleView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
152 InkDropHostView::RemoveInkDropLayer(ink_drop_layer); | 152 InkDropHostView::RemoveInkDropLayer(ink_drop_layer); |
153 image()->SetPaintToLayer(false); | 153 image()->DestroyLayer(); |
154 } | 154 } |
155 | 155 |
156 std::unique_ptr<views::InkDropHighlight> | 156 std::unique_ptr<views::InkDropHighlight> |
157 IconLabelBubbleView::CreateInkDropHighlight() const { | 157 IconLabelBubbleView::CreateInkDropHighlight() const { |
158 // Only show a highlight effect when the label is empty/invisible. | 158 // Only show a highlight effect when the label is empty/invisible. |
159 return label()->visible() ? nullptr | 159 return label()->visible() ? nullptr |
160 : InkDropHostView::CreateInkDropHighlight(); | 160 : InkDropHostView::CreateInkDropHighlight(); |
161 } | 161 } |
162 | 162 |
163 SkColor IconLabelBubbleView::GetInkDropBaseColor() const { | 163 SkColor IconLabelBubbleView::GetInkDropBaseColor() const { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 241 |
242 // Draw the 1 px separator. | 242 // Draw the 1 px separator. |
243 gfx::ScopedCanvas scoped_canvas(canvas); | 243 gfx::ScopedCanvas scoped_canvas(canvas); |
244 const float scale = canvas->UndoDeviceScaleFactor(); | 244 const float scale = canvas->UndoDeviceScaleFactor(); |
245 // Keep the separator aligned on a pixel center. | 245 // Keep the separator aligned on a pixel center. |
246 const gfx::RectF pixel_aligned_bounds = | 246 const gfx::RectF pixel_aligned_bounds = |
247 gfx::ScaleRect(gfx::RectF(bounds), scale) - gfx::Vector2dF(0.5f, 0); | 247 gfx::ScaleRect(gfx::RectF(bounds), scale) - gfx::Vector2dF(0.5f, 0); |
248 canvas->DrawLine(pixel_aligned_bounds.top_right(), | 248 canvas->DrawLine(pixel_aligned_bounds.top_right(), |
249 pixel_aligned_bounds.bottom_right(), separator_color); | 249 pixel_aligned_bounds.bottom_right(), separator_color); |
250 } | 250 } |
OLD | NEW |