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

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

Issue 2344663003: Restrict width of the Subresource Filtering bubble to 320px. (Closed)
Patch Set: comments and names updates Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "ui/views/layout/grid_layout.h" 42 #include "ui/views/layout/grid_layout.h"
43 #include "ui/views/layout/layout_constants.h" 43 #include "ui/views/layout/layout_constants.h"
44 #include "ui/views/native_cursor.h" 44 #include "ui/views/native_cursor.h"
45 45
46 namespace { 46 namespace {
47 47
48 // If we don't clamp the maximum width, then very long URLs and titles can make 48 // If we don't clamp the maximum width, then very long URLs and titles can make
49 // the bubble arbitrarily wide. 49 // the bubble arbitrarily wide.
50 const int kMaxContentsWidth = 500; 50 const int kMaxContentsWidth = 500;
51 51
52 // The new default width for the content settings bubble. The review process to
53 // the width on per-bubble basis is tracked with https://crbug.com/649650.
54 const int kMaxDefaultContentsWidth = 320;
55
52 // When we have multiline labels, we should set a minimum width lest we get very 56 // When we have multiline labels, we should set a minimum width lest we get very
53 // narrow bubbles with lots of line-wrapping. 57 // narrow bubbles with lots of line-wrapping.
54 const int kMinMultiLineContentsWidth = 250; 58 const int kMinMultiLineContentsWidth = 250;
55 59
56 } // namespace 60 } // namespace
57 61
58 using content::PluginService; 62 using content::PluginService;
59 using content::WebContents; 63 using content::WebContents;
60 64
61 // ContentSettingBubbleContents::MediaComboboxModel ---------------------------- 65 // ContentSettingBubbleContents::MediaComboboxModel ----------------------------
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 RemoveAllChildViews(true); 179 RemoveAllChildViews(true);
176 } 180 }
177 181
178 gfx::Size ContentSettingBubbleContents::GetPreferredSize() const { 182 gfx::Size ContentSettingBubbleContents::GetPreferredSize() const {
179 gfx::Size preferred_size(views::View::GetPreferredSize()); 183 gfx::Size preferred_size(views::View::GetPreferredSize());
180 int preferred_width = 184 int preferred_width =
181 (!content_setting_bubble_model_->bubble_content().domain_lists.empty() && 185 (!content_setting_bubble_model_->bubble_content().domain_lists.empty() &&
182 (kMinMultiLineContentsWidth > preferred_size.width())) 186 (kMinMultiLineContentsWidth > preferred_size.width()))
183 ? kMinMultiLineContentsWidth 187 ? kMinMultiLineContentsWidth
184 : preferred_size.width(); 188 : preferred_size.width();
185 preferred_size.set_width(std::min(preferred_width, kMaxContentsWidth)); 189 if (content_setting_bubble_model_->AsSubresourceFilterBubbleModel()) {
190 preferred_size.set_width(std::min(preferred_width,
191 kMaxDefaultContentsWidth));
192 } else {
193 preferred_size.set_width(std::min(preferred_width, kMaxContentsWidth));
194 }
186 return preferred_size; 195 return preferred_size;
187 } 196 }
188 197
189 void ContentSettingBubbleContents::Init() { 198 void ContentSettingBubbleContents::Init() {
190 using views::GridLayout; 199 using views::GridLayout;
191 200
192 GridLayout* layout = new views::GridLayout(this); 201 GridLayout* layout = new views::GridLayout(this);
193 SetLayoutManager(layout); 202 SetLayoutManager(layout);
194 203
195 const int kSingleColumnSetId = 0; 204 const int kSingleColumnSetId = 0;
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 DCHECK(i != list_item_links_.end()); 469 DCHECK(i != list_item_links_.end());
461 content_setting_bubble_model_->OnListItemClicked(i->second); 470 content_setting_bubble_model_->OnListItemClicked(i->second);
462 } 471 }
463 472
464 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { 473 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) {
465 MediaComboboxModel* model = 474 MediaComboboxModel* model =
466 static_cast<MediaComboboxModel*>(combobox->model()); 475 static_cast<MediaComboboxModel*>(combobox->model());
467 content_setting_bubble_model_->OnMediaMenuClicked( 476 content_setting_bubble_model_->OnMediaMenuClicked(
468 model->type(), model->GetDevices()[combobox->selected_index()].id); 477 model->type(), model->GetDevices()[combobox->selected_index()].id);
469 } 478 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698