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/views/location_bar/location_bar_view.h" | 8 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 if (hover_background_painter_.get()) | 109 if (hover_background_painter_.get()) |
110 SchedulePaint(); | 110 SchedulePaint(); |
111 } | 111 } |
112 | 112 |
113 // static | 113 // static |
114 int IconLabelBubbleView::GetBubbleOuterPadding(bool by_icon) { | 114 int IconLabelBubbleView::GetBubbleOuterPadding(bool by_icon) { |
115 return LocationBarView::kItemPadding - LocationBarView::kBubblePadding + | 115 return LocationBarView::kItemPadding - LocationBarView::kBubblePadding + |
116 (by_icon ? 0 : LocationBarView::kIconInternalPadding); | 116 (by_icon ? 0 : LocationBarView::kIconInternalPadding); |
117 } | 117 } |
118 | 118 |
| 119 const char* IconLabelBubbleView::GetClassName() const { |
| 120 return "IconLabelBubbleView"; |
| 121 } |
| 122 |
119 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) { | 123 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) { |
120 views::Painter* painter = (in_hover_ && hover_background_painter_) ? | 124 views::Painter* painter = (in_hover_ && hover_background_painter_) ? |
121 hover_background_painter_.get() : background_painter_.get(); | 125 hover_background_painter_.get() : background_painter_.get(); |
122 painter->Paint(canvas, size()); | 126 painter->Paint(canvas, size()); |
123 } | 127 } |
124 | 128 |
125 int IconLabelBubbleView::GetPreLabelWidth() const { | 129 int IconLabelBubbleView::GetPreLabelWidth() const { |
126 const int image_width = image_->GetPreferredSize().width(); | 130 const int image_width = image_->GetPreferredSize().width(); |
127 return GetBubbleOuterPadding(true) + | 131 return GetBubbleOuterPadding(true) + |
128 (image_width ? (image_width + LocationBarView::kItemPadding) : 0); | 132 (image_width ? (image_width + LocationBarView::kItemPadding) : 0); |
129 } | 133 } |
OLD | NEW |