Index: chrome/browser/ui/views/location_bar/content_setting_image_view.cc |
diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc |
index 0aaf76d8af8e94e232d9e932613cbfb44244f862..861b5cde8e47c337e7fba9b73283c89b144b2b3c 100644 |
--- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc |
+++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc |
@@ -69,8 +69,11 @@ ContentSettingImageView::~ContentSettingImageView() { |
} |
} |
-void ContentSettingImageView::UpdateFromWebContents(WebContents* web_contents) { |
- content_setting_image_model_->UpdateFromWebContents(web_contents); |
+void ContentSettingImageView::Update(TabContents* tab_contents) { |
+ if (tab_contents) { |
+ content_setting_image_model_->UpdateFromWebContents( |
+ tab_contents->web_contents()); |
+ } |
if (!content_setting_image_model_->is_visible()) { |
SetVisible(false); |
return; |
@@ -81,10 +84,9 @@ void ContentSettingImageView::UpdateFromWebContents(WebContents* web_contents) { |
SetVisible(true); |
TabSpecificContentSettings* content_settings = NULL; |
- if (web_contents) { |
- content_settings = |
- TabContents::FromWebContents(web_contents)->content_settings(); |
- } |
+ if (tab_contents) |
+ content_settings = tab_contents->content_settings(); |
+ |
if (!content_settings || content_settings->IsBlockageIndicated( |
content_setting_image_model_->get_content_settings_type())) |
return; |
@@ -168,6 +170,10 @@ void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event) { |
if (!HitTest(event.location())) |
return; |
+ OnClick(); |
+} |
+ |
+void ContentSettingImageView::OnClick() { |
TabContents* tab_contents = parent_->GetTabContents(); |
if (!tab_contents) |
return; |
@@ -234,7 +240,7 @@ void ContentSettingImageView::OnPaintBackground(gfx::Canvas* canvas) { |
SkPaint paint; |
paint.setShader(gfx::CreateGradientShader(kEdgeThickness, |
height() - (2 * kEdgeThickness), |
- kTopBoxColor, kBottomBoxColor)); |
+ gradient_top_color(), gradient_bottom_color())); |
SkSafeUnref(paint.getShader()); |
SkRect color_rect; |
color_rect.iset(0, 0, width() - 1, height() - 1); |
@@ -242,7 +248,7 @@ void ContentSettingImageView::OnPaintBackground(gfx::Canvas* canvas) { |
kBoxCornerRadius, paint); |
SkPaint outer_paint; |
outer_paint.setStyle(SkPaint::kStroke_Style); |
- outer_paint.setColor(kBorderColor); |
+ outer_paint.setColor(button_border_color()); |
color_rect.inset(SkIntToScalar(kEdgeThickness), |
SkIntToScalar(kEdgeThickness)); |
canvas->sk_canvas()->drawRoundRect(color_rect, kBoxCornerRadius, |
@@ -270,3 +276,14 @@ int ContentSettingImageView::GetBuiltInHorizontalPadding() const { |
return GetBuiltInHorizontalPaddingImpl(); |
} |
+SkColor ContentSettingImageView::button_border_color() const { |
sky
2012/08/07 03:33:00
Order doesn't match header.
Greg Billock
2012/08/07 19:29:04
These are right under GetBuiltInHorizontalPadding
|
+ return kBorderColor; |
+} |
+ |
+SkColor ContentSettingImageView::gradient_top_color() const { |
+ return kTopBoxColor; |
+} |
+ |
+SkColor ContentSettingImageView::gradient_bottom_color() const { |
+ return kBottomBoxColor; |
+} |