| 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/layout_constants.h" | 7 #include "chrome/browser/ui/layout_constants.h" |
| 8 #include "ui/accessibility/ax_node_data.h" |
| 8 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
| 9 #include "ui/gfx/color_utils.h" | 10 #include "ui/gfx/color_utils.h" |
| 10 #include "ui/gfx/scoped_canvas.h" | 11 #include "ui/gfx/scoped_canvas.h" |
| 11 #include "ui/native_theme/native_theme.h" | 12 #include "ui/native_theme/native_theme.h" |
| 12 #include "ui/views/animation/ink_drop_highlight.h" | 13 #include "ui/views/animation/ink_drop_highlight.h" |
| 13 #include "ui/views/border.h" | 14 #include "ui/views/border.h" |
| 14 #include "ui/views/controls/image_view.h" | 15 #include "ui/views/controls/image_view.h" |
| 15 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 label_->SetBounds(label_x, 0, label_width, height()); | 131 label_->SetBounds(label_x, 0, label_width, height()); |
| 131 } | 132 } |
| 132 | 133 |
| 133 void IconLabelBubbleView::OnNativeThemeChanged( | 134 void IconLabelBubbleView::OnNativeThemeChanged( |
| 134 const ui::NativeTheme* native_theme) { | 135 const ui::NativeTheme* native_theme) { |
| 135 label_->SetEnabledColor(GetTextColor()); | 136 label_->SetEnabledColor(GetTextColor()); |
| 136 label_->SetBackgroundColor(GetParentBackgroundColor()); | 137 label_->SetBackgroundColor(GetParentBackgroundColor()); |
| 137 SchedulePaint(); | 138 SchedulePaint(); |
| 138 } | 139 } |
| 139 | 140 |
| 141 void IconLabelBubbleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 142 label_->GetAccessibleNodeData(node_data); |
| 143 } |
| 144 |
| 140 void IconLabelBubbleView::AddInkDropLayer(ui::Layer* ink_drop_layer) { | 145 void IconLabelBubbleView::AddInkDropLayer(ui::Layer* ink_drop_layer) { |
| 141 image()->SetPaintToLayer(true); | 146 image()->SetPaintToLayer(true); |
| 142 image()->layer()->SetFillsBoundsOpaquely(false); | 147 image()->layer()->SetFillsBoundsOpaquely(false); |
| 143 InkDropHostView::AddInkDropLayer(ink_drop_layer); | 148 InkDropHostView::AddInkDropLayer(ink_drop_layer); |
| 144 } | 149 } |
| 145 | 150 |
| 146 void IconLabelBubbleView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { | 151 void IconLabelBubbleView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) { |
| 147 InkDropHostView::RemoveInkDropLayer(ink_drop_layer); | 152 InkDropHostView::RemoveInkDropLayer(ink_drop_layer); |
| 148 image()->SetPaintToLayer(false); | 153 image()->SetPaintToLayer(false); |
| 149 } | 154 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 242 |
| 238 // Draw the 1 px separator. | 243 // Draw the 1 px separator. |
| 239 gfx::ScopedCanvas scoped_canvas(canvas); | 244 gfx::ScopedCanvas scoped_canvas(canvas); |
| 240 const float scale = canvas->UndoDeviceScaleFactor(); | 245 const float scale = canvas->UndoDeviceScaleFactor(); |
| 241 // Keep the separator aligned on a pixel center. | 246 // Keep the separator aligned on a pixel center. |
| 242 const gfx::RectF pixel_aligned_bounds = | 247 const gfx::RectF pixel_aligned_bounds = |
| 243 gfx::ScaleRect(gfx::RectF(bounds), scale) - gfx::Vector2dF(0.5f, 0); | 248 gfx::ScaleRect(gfx::RectF(bounds), scale) - gfx::Vector2dF(0.5f, 0); |
| 244 canvas->DrawLine(pixel_aligned_bounds.top_right(), | 249 canvas->DrawLine(pixel_aligned_bounds.top_right(), |
| 245 pixel_aligned_bounds.bottom_right(), separator_color); | 250 pixel_aligned_bounds.bottom_right(), separator_color); |
| 246 } | 251 } |
| OLD | NEW |