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