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/content_setting_image_view.h" | 5 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
9 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 9 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // alpha. This is because AlphaBlend(a, b, 255) always returns |a| unchanged | 76 // alpha. This is because AlphaBlend(a, b, 255) always returns |a| unchanged |
77 // even if |a| is a color with non-255 alpha. | 77 // even if |a| is a color with non-255 alpha. |
78 text_label_->SetBackgroundColor( | 78 text_label_->SetBackgroundColor( |
79 color_utils::AlphaBlend(SkColorSetA(background_image_color, 255), | 79 color_utils::AlphaBlend(SkColorSetA(background_image_color, 255), |
80 parent_background_color, | 80 parent_background_color, |
81 SkColorGetA(background_image_color))); | 81 SkColorGetA(background_image_color))); |
82 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 82 text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
83 text_label_->SetElideBehavior(views::Label::NO_ELIDE); | 83 text_label_->SetElideBehavior(views::Label::NO_ELIDE); |
84 AddChildView(text_label_); | 84 AddChildView(text_label_); |
85 | 85 |
86 TouchableLocationBarView::Init(this); | 86 LocationBarView::InitTouchableLocationBarChildView(this); |
87 | 87 |
88 slide_animator_.SetSlideDuration(kAnimationDurationMS); | 88 slide_animator_.SetSlideDuration(kAnimationDurationMS); |
89 slide_animator_.SetTweenType(ui::Tween::LINEAR); | 89 slide_animator_.SetTweenType(ui::Tween::LINEAR); |
90 } | 90 } |
91 | 91 |
92 ContentSettingImageView::~ContentSettingImageView() { | 92 ContentSettingImageView::~ContentSettingImageView() { |
93 if (bubble_widget_) | 93 if (bubble_widget_) |
94 bubble_widget_->RemoveObserver(this); | 94 bubble_widget_->RemoveObserver(this); |
95 } | 95 } |
96 | 96 |
97 int ContentSettingImageView::GetBuiltInHorizontalPadding() const { | |
98 return GetBuiltInHorizontalPaddingImpl(); | |
99 } | |
100 | |
101 void ContentSettingImageView::Update(content::WebContents* web_contents) { | 97 void ContentSettingImageView::Update(content::WebContents* web_contents) { |
102 // Note: We explicitly want to call this even if |web_contents| is NULL, so we | 98 // Note: We explicitly want to call this even if |web_contents| is NULL, so we |
103 // get hidden properly while the user is editing the omnibox. | 99 // get hidden properly while the user is editing the omnibox. |
104 content_setting_image_model_->UpdateFromWebContents(web_contents); | 100 content_setting_image_model_->UpdateFromWebContents(web_contents); |
105 | 101 |
106 if (!content_setting_image_model_->is_visible()) { | 102 if (!content_setting_image_model_->is_visible()) { |
107 SetVisible(false); | 103 SetVisible(false); |
108 return; | 104 return; |
109 } | 105 } |
110 | 106 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 parent_->delegate()->CreateViewsBubble(new ContentSettingBubbleContents( | 250 parent_->delegate()->CreateViewsBubble(new ContentSettingBubbleContents( |
255 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 251 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
256 parent_->delegate()->GetContentSettingBubbleModelDelegate(), | 252 parent_->delegate()->GetContentSettingBubbleModelDelegate(), |
257 web_contents, parent_->profile(), | 253 web_contents, parent_->profile(), |
258 content_setting_image_model_->get_content_settings_type()), | 254 content_setting_image_model_->get_content_settings_type()), |
259 web_contents, this, views::BubbleBorder::TOP_RIGHT)); | 255 web_contents, this, views::BubbleBorder::TOP_RIGHT)); |
260 bubble_widget_->AddObserver(this); | 256 bubble_widget_->AddObserver(this); |
261 bubble_widget_->Show(); | 257 bubble_widget_->Show(); |
262 } | 258 } |
263 } | 259 } |
OLD | NEW |