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 "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/ui/layout_constants.h" | 8 #include "chrome/browser/ui/layout_constants.h" |
9 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" | 9 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" |
10 #include "ui/base/material_design/material_design_controller.h" | 10 #include "ui/base/material_design/material_design_controller.h" |
11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
12 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
13 #include "ui/gfx/color_utils.h" | 13 #include "ui/gfx/color_utils.h" |
14 #include "ui/gfx/image/image_util.h" | 14 #include "ui/gfx/image/image_util.h" |
15 #include "ui/gfx/scoped_canvas.h" | 15 #include "ui/gfx/scoped_canvas.h" |
16 #include "ui/native_theme/native_theme.h" | 16 #include "ui/native_theme/native_theme.h" |
17 #include "ui/views/animation/ink_drop_hover.h" | 17 #include "ui/views/animation/ink_drop_highlight.h" |
18 #include "ui/views/border.h" | 18 #include "ui/views/border.h" |
19 #include "ui/views/controls/image_view.h" | 19 #include "ui/views/controls/image_view.h" |
20 #include "ui/views/controls/textfield/textfield.h" | 20 #include "ui/views/controls/textfield/textfield.h" |
21 #include "ui/views/painter.h" | 21 #include "ui/views/painter.h" |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 // Extra padding to place at the end of the chip when the label is showing. | 25 // Extra padding to place at the end of the chip when the label is showing. |
26 const int kExtraTrailingPadding = 7; | 26 const int kExtraTrailingPadding = 7; |
27 | 27 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 image()->SetPaintToLayer(true); | 197 image()->SetPaintToLayer(true); |
198 image()->layer()->SetFillsBoundsOpaquely(false); | 198 image()->layer()->SetFillsBoundsOpaquely(false); |
199 InkDropHostView::AddInkDropLayer(ink_drop_layer); | 199 InkDropHostView::AddInkDropLayer(ink_drop_layer); |
200 } | 200 } |
201 | 201 |
202 void IconLabelBubbleView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 202 void IconLabelBubbleView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
203 InkDropHostView::RemoveInkDropLayer(ink_drop_layer); | 203 InkDropHostView::RemoveInkDropLayer(ink_drop_layer); |
204 image()->SetPaintToLayer(false); | 204 image()->SetPaintToLayer(false); |
205 } | 205 } |
206 | 206 |
207 std::unique_ptr<views::InkDropHover> IconLabelBubbleView::CreateInkDropHover() | 207 std::unique_ptr<views::InkDropHighlight> |
208 const { | 208 IconLabelBubbleView::CreateInkDropHighlight() const { |
209 // Location bar views don't show hover effect. | 209 // Location bar views don't show hover effect. |
210 return nullptr; | 210 return nullptr; |
211 } | 211 } |
212 | 212 |
213 SkColor IconLabelBubbleView::GetInkDropBaseColor() const { | 213 SkColor IconLabelBubbleView::GetInkDropBaseColor() const { |
214 return color_utils::DeriveDefaultIconColor(GetTextColor()); | 214 return color_utils::DeriveDefaultIconColor(GetTextColor()); |
215 } | 215 } |
216 | 216 |
217 SkColor IconLabelBubbleView::GetParentBackgroundColor() const { | 217 SkColor IconLabelBubbleView::GetParentBackgroundColor() const { |
218 return ui::MaterialDesignController::IsModeMaterial() | 218 return ui::MaterialDesignController::IsModeMaterial() |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 // 1px at all scale factors. | 320 // 1px at all scale factors. |
321 gfx::ScopedCanvas scoped_canvas(canvas); | 321 gfx::ScopedCanvas scoped_canvas(canvas); |
322 const float scale = canvas->UndoDeviceScaleFactor(); | 322 const float scale = canvas->UndoDeviceScaleFactor(); |
323 const gfx::RectF pixel_aligned_bounds = | 323 const gfx::RectF pixel_aligned_bounds = |
324 gfx::ScaleRect(gfx::RectF(bounds), scale) - gfx::Vector2dF(0.5f, 0); | 324 gfx::ScaleRect(gfx::RectF(bounds), scale) - gfx::Vector2dF(0.5f, 0); |
325 canvas->DrawLine(pixel_aligned_bounds.top_right(), | 325 canvas->DrawLine(pixel_aligned_bounds.top_right(), |
326 pixel_aligned_bounds.bottom_right(), separator_color); | 326 pixel_aligned_bounds.bottom_right(), separator_color); |
327 } | 327 } |
328 } | 328 } |
OLD | NEW |