Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: chrome/browser/ui/views/content_setting_bubble_contents.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 manage_link_(NULL), 147 manage_link_(NULL),
148 close_button_(NULL) { 148 close_button_(NULL) {
149 // Compensate for built-in vertical padding in the anchor view's image. 149 // Compensate for built-in vertical padding in the anchor view's image.
150 set_anchor_view_insets(gfx::Insets(5, 0, 5, 0)); 150 set_anchor_view_insets(gfx::Insets(5, 0, 5, 0));
151 } 151 }
152 152
153 ContentSettingBubbleContents::~ContentSettingBubbleContents() { 153 ContentSettingBubbleContents::~ContentSettingBubbleContents() {
154 STLDeleteValues(&media_menus_); 154 STLDeleteValues(&media_menus_);
155 } 155 }
156 156
157 gfx::Size ContentSettingBubbleContents::GetPreferredSize() { 157 gfx::Size ContentSettingBubbleContents::GetPreferredSize() const {
158 gfx::Size preferred_size(views::View::GetPreferredSize()); 158 gfx::Size preferred_size(views::View::GetPreferredSize());
159 int preferred_width = 159 int preferred_width =
160 (!content_setting_bubble_model_->bubble_content().domain_lists.empty() && 160 (!content_setting_bubble_model_->bubble_content().domain_lists.empty() &&
161 (kMinMultiLineContentsWidth > preferred_size.width())) ? 161 (kMinMultiLineContentsWidth > preferred_size.width())) ?
162 kMinMultiLineContentsWidth : preferred_size.width(); 162 kMinMultiLineContentsWidth : preferred_size.width();
163 preferred_size.set_width(std::min(preferred_width, kMaxContentsWidth)); 163 preferred_size.set_width(std::min(preferred_width, kMaxContentsWidth));
164 return preferred_size; 164 return preferred_size;
165 } 165 }
166 166
167 void ContentSettingBubbleContents::UpdateMenuLabel( 167 void ContentSettingBubbleContents::UpdateMenuLabel(
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 int width = button->GetPreferredSize().width(); 461 int width = button->GetPreferredSize().width();
462 for (int i = 0; i < menu_model->GetItemCount(); ++i) { 462 for (int i = 0; i < menu_model->GetItemCount(); ++i) {
463 button->SetText(menu_model->GetLabelAt(i)); 463 button->SetText(menu_model->GetLabelAt(i));
464 width = std::max(width, button->GetPreferredSize().width()); 464 width = std::max(width, button->GetPreferredSize().width());
465 } 465 }
466 466
467 // Recover the title for the menu button. 467 // Recover the title for the menu button.
468 button->SetText(title); 468 button->SetText(title);
469 return width; 469 return width;
470 } 470 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/content_setting_bubble_contents.h ('k') | chrome/browser/ui/views/create_application_shortcut_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698