| 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" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 InkDropHostView::AddInkDropLayer(ink_drop_layer); | 200 InkDropHostView::AddInkDropLayer(ink_drop_layer); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void IconLabelBubbleView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 203 void IconLabelBubbleView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
| 204 InkDropHostView::RemoveInkDropLayer(ink_drop_layer); | 204 InkDropHostView::RemoveInkDropLayer(ink_drop_layer); |
| 205 image()->SetPaintToLayer(false); | 205 image()->SetPaintToLayer(false); |
| 206 } | 206 } |
| 207 | 207 |
| 208 std::unique_ptr<views::InkDropHighlight> | 208 std::unique_ptr<views::InkDropHighlight> |
| 209 IconLabelBubbleView::CreateInkDropHighlight() const { | 209 IconLabelBubbleView::CreateInkDropHighlight() const { |
| 210 // Location bar views don't show hover effect. | 210 // Only show a highlight effect when the label is empty/invisible. |
| 211 return nullptr; | 211 return label()->visible() ? nullptr |
| 212 : InkDropHostView::CreateInkDropHighlight(); |
| 212 } | 213 } |
| 213 | 214 |
| 214 SkColor IconLabelBubbleView::GetInkDropBaseColor() const { | 215 SkColor IconLabelBubbleView::GetInkDropBaseColor() const { |
| 215 return color_utils::DeriveDefaultIconColor(GetTextColor()); | 216 return color_utils::DeriveDefaultIconColor(GetTextColor()); |
| 216 } | 217 } |
| 217 | 218 |
| 218 SkColor IconLabelBubbleView::GetParentBackgroundColor() const { | 219 SkColor IconLabelBubbleView::GetParentBackgroundColor() const { |
| 219 return ui::MaterialDesignController::IsModeMaterial() | 220 return ui::MaterialDesignController::IsModeMaterial() |
| 220 ? GetNativeTheme()->GetSystemColor( | 221 ? GetNativeTheme()->GetSystemColor( |
| 221 ui::NativeTheme::kColorId_TextfieldDefaultBackground) | 222 ui::NativeTheme::kColorId_TextfieldDefaultBackground) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 // Draw the 1 px separator. | 329 // Draw the 1 px separator. |
| 329 gfx::ScopedCanvas scoped_canvas(canvas); | 330 gfx::ScopedCanvas scoped_canvas(canvas); |
| 330 const float scale = canvas->UndoDeviceScaleFactor(); | 331 const float scale = canvas->UndoDeviceScaleFactor(); |
| 331 // Keep the separator aligned on a pixel center. | 332 // Keep the separator aligned on a pixel center. |
| 332 const gfx::RectF pixel_aligned_bounds = | 333 const gfx::RectF pixel_aligned_bounds = |
| 333 gfx::ScaleRect(gfx::RectF(bounds), scale) - gfx::Vector2dF(0.5f, 0); | 334 gfx::ScaleRect(gfx::RectF(bounds), scale) - gfx::Vector2dF(0.5f, 0); |
| 334 canvas->DrawLine(pixel_aligned_bounds.top_right(), | 335 canvas->DrawLine(pixel_aligned_bounds.top_right(), |
| 335 pixel_aligned_bounds.bottom_right(), separator_color); | 336 pixel_aligned_bounds.bottom_right(), separator_color); |
| 336 } | 337 } |
| 337 } | 338 } |
| OLD | NEW |