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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 const int icon_width = icon_->GetPreferredSize().width(); | 180 const int icon_width = icon_->GetPreferredSize().width(); |
181 icon_->SetBounds( | 181 icon_->SetBounds( |
182 std::min((width() - icon_width) / 2, GetBubbleOuterPadding(true)), 0, | 182 std::min((width() - icon_width) / 2, GetBubbleOuterPadding(true)), 0, |
183 icon_width, height()); | 183 icon_width, height()); |
184 text_label_->SetBounds( | 184 text_label_->SetBounds( |
185 icon_->bounds().right() + LocationBarView::kItemPadding, 0, | 185 icon_->bounds().right() + LocationBarView::kItemPadding, 0, |
186 std::max(width() - GetTotalSpacingWhileAnimating() - icon_width, 0), | 186 std::max(width() - GetTotalSpacingWhileAnimating() - icon_width, 0), |
187 height()); | 187 height()); |
188 } | 188 } |
189 | 189 |
| 190 const char* ContentSettingImageView::GetClassName() const { |
| 191 return "ContentSettingsImageView"; |
| 192 } |
| 193 |
190 bool ContentSettingImageView::OnMousePressed(const ui::MouseEvent& event) { | 194 bool ContentSettingImageView::OnMousePressed(const ui::MouseEvent& event) { |
191 // We want to show the bubble on mouse release; that is the standard behavior | 195 // We want to show the bubble on mouse release; that is the standard behavior |
192 // for buttons. | 196 // for buttons. |
193 return true; | 197 return true; |
194 } | 198 } |
195 | 199 |
196 void ContentSettingImageView::OnMouseReleased(const ui::MouseEvent& event) { | 200 void ContentSettingImageView::OnMouseReleased(const ui::MouseEvent& event) { |
197 if (HitTestPoint(event.location())) | 201 if (HitTestPoint(event.location())) |
198 OnClick(); | 202 OnClick(); |
199 } | 203 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 parent_->delegate()->CreateViewsBubble(new ContentSettingBubbleContents( | 247 parent_->delegate()->CreateViewsBubble(new ContentSettingBubbleContents( |
244 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 248 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
245 parent_->delegate()->GetContentSettingBubbleModelDelegate(), | 249 parent_->delegate()->GetContentSettingBubbleModelDelegate(), |
246 web_contents, parent_->profile(), | 250 web_contents, parent_->profile(), |
247 content_setting_image_model_->get_content_settings_type()), | 251 content_setting_image_model_->get_content_settings_type()), |
248 web_contents, this, views::BubbleBorder::TOP_RIGHT)); | 252 web_contents, this, views::BubbleBorder::TOP_RIGHT)); |
249 bubble_widget_->AddObserver(this); | 253 bubble_widget_->AddObserver(this); |
250 bubble_widget_->Show(); | 254 bubble_widget_->Show(); |
251 } | 255 } |
252 } | 256 } |
OLD | NEW |