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/content_setting_bubble_contents.h" | 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 WebContents* web_contents, | 144 WebContents* web_contents, |
145 views::View* anchor_view, | 145 views::View* anchor_view, |
146 views::BubbleBorder::ArrowLocation arrow_location) | 146 views::BubbleBorder::ArrowLocation arrow_location) |
147 : BubbleDelegateView(anchor_view, arrow_location), | 147 : BubbleDelegateView(anchor_view, arrow_location), |
148 content_setting_bubble_model_(content_setting_bubble_model), | 148 content_setting_bubble_model_(content_setting_bubble_model), |
149 web_contents_(web_contents), | 149 web_contents_(web_contents), |
150 custom_link_(NULL), | 150 custom_link_(NULL), |
151 manage_link_(NULL), | 151 manage_link_(NULL), |
152 close_button_(NULL) { | 152 close_button_(NULL) { |
153 // Compensate for built-in vertical padding in the anchor view's image. | 153 // Compensate for built-in vertical padding in the anchor view's image. |
154 set_anchor_insets(gfx::Insets(5, 0, 5, 0)); | 154 set_anchor_view_insets(gfx::Insets(5, 0, 5, 0)); |
155 | 155 |
156 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 156 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
157 content::Source<WebContents>(web_contents)); | 157 content::Source<WebContents>(web_contents)); |
158 } | 158 } |
159 | 159 |
160 ContentSettingBubbleContents::~ContentSettingBubbleContents() { | 160 ContentSettingBubbleContents::~ContentSettingBubbleContents() { |
161 STLDeleteValues(&media_menus_); | 161 STLDeleteValues(&media_menus_); |
162 } | 162 } |
163 | 163 |
164 gfx::Size ContentSettingBubbleContents::GetPreferredSize() { | 164 gfx::Size ContentSettingBubbleContents::GetPreferredSize() { |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 int width = button->GetPreferredSize().width(); | 483 int width = button->GetPreferredSize().width(); |
484 for (int i = 0; i < menu_model->GetItemCount(); ++i) { | 484 for (int i = 0; i < menu_model->GetItemCount(); ++i) { |
485 button->SetText(menu_model->GetLabelAt(i)); | 485 button->SetText(menu_model->GetLabelAt(i)); |
486 width = std::max(width, button->GetPreferredSize().width()); | 486 width = std::max(width, button->GetPreferredSize().width()); |
487 } | 487 } |
488 | 488 |
489 // Recover the title for the menu button. | 489 // Recover the title for the menu button. |
490 button->SetText(title); | 490 button->SetText(title); |
491 return width; | 491 return width; |
492 } | 492 } |
OLD | NEW |