| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 bitmap.getColor(bitmap.width() / 2, bitmap.height() / 2); | 57 bitmap.getColor(bitmap.width() / 2, bitmap.height() / 2); |
| 58 // Tricky bit: We alpha blend an opaque version of |background_image_color| | 58 // Tricky bit: We alpha blend an opaque version of |background_image_color| |
| 59 // against |parent_background_color| using the original image grid color's | 59 // against |parent_background_color| using the original image grid color's |
| 60 // alpha. This is because AlphaBlend(a, b, 255) always returns |a| unchanged | 60 // alpha. This is because AlphaBlend(a, b, 255) always returns |a| unchanged |
| 61 // even if |a| is a color with non-255 alpha. | 61 // even if |a| is a color with non-255 alpha. |
| 62 label_->SetBackgroundColor( | 62 label_->SetBackgroundColor( |
| 63 color_utils::AlphaBlend(SkColorSetA(background_image_color, 255), | 63 color_utils::AlphaBlend(SkColorSetA(background_image_color, 255), |
| 64 parent_background_color, | 64 parent_background_color, |
| 65 SkColorGetA(background_image_color))); | 65 SkColorGetA(background_image_color))); |
| 66 if (elide_in_middle) | 66 if (elide_in_middle) |
| 67 label_->SetElideBehavior(views::Label::ELIDE_IN_MIDDLE); | 67 label_->SetElideBehavior(gfx::ELIDE_MIDDLE); |
| 68 AddChildView(label_); | 68 AddChildView(label_); |
| 69 } | 69 } |
| 70 | 70 |
| 71 IconLabelBubbleView::~IconLabelBubbleView() { | 71 IconLabelBubbleView::~IconLabelBubbleView() { |
| 72 } | 72 } |
| 73 | 73 |
| 74 void IconLabelBubbleView::SetLabel(const base::string16& label) { | 74 void IconLabelBubbleView::SetLabel(const base::string16& label) { |
| 75 label_->SetText(label); | 75 label_->SetText(label); |
| 76 } | 76 } |
| 77 | 77 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 views::Painter* painter = (in_hover_ && hover_background_painter_) ? | 121 views::Painter* painter = (in_hover_ && hover_background_painter_) ? |
| 122 hover_background_painter_.get() : background_painter_.get(); | 122 hover_background_painter_.get() : background_painter_.get(); |
| 123 painter->Paint(canvas, size()); | 123 painter->Paint(canvas, size()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 int IconLabelBubbleView::GetPreLabelWidth() const { | 126 int IconLabelBubbleView::GetPreLabelWidth() const { |
| 127 const int image_width = image_->GetPreferredSize().width(); | 127 const int image_width = image_->GetPreferredSize().width(); |
| 128 return GetBubbleOuterPadding(true) + | 128 return GetBubbleOuterPadding(true) + |
| 129 (image_width ? (image_width + LocationBarView::kItemPadding) : 0); | 129 (image_width ? (image_width + LocationBarView::kItemPadding) : 0); |
| 130 } | 130 } |
| OLD | NEW |