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

Side by Side Diff: chrome/browser/ui/views/website_settings/permission_selector_row.cc

Issue 2647633002: Do not size PermissionSelectorRow to preferred size (Closed)
Patch Set: Created 3 years, 11 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/website_settings/permission_selector_row.h" 5 #include "chrome/browser/ui/views/website_settings/permission_selector_row.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/ui/views/website_settings/non_accessible_image_view.h" 10 #include "chrome/browser/ui/views/website_settings/non_accessible_image_view.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 else 286 else
287 InitializeMenuButtonView(layout, permission); 287 InitializeMenuButtonView(layout, permission);
288 } 288 }
289 289
290 void PermissionSelectorRow::AddObserver( 290 void PermissionSelectorRow::AddObserver(
291 PermissionSelectorRowObserver* observer) { 291 PermissionSelectorRowObserver* observer) {
292 observer_list_.AddObserver(observer); 292 observer_list_.AddObserver(observer);
293 } 293 }
294 294
295 void PermissionSelectorRow::ChildPreferredSizeChanged(View* child) { 295 void PermissionSelectorRow::ChildPreferredSizeChanged(View* child) {
296 SizeToPreferredSize(); 296 Layout();
297 // FIXME: The parent is only a plain |View| that is used as a
298 // container/box/panel. The SizeToPreferredSize method of the parent is
299 // called here directly in order not to implement a custom |View| class with
300 // its own implementation of the ChildPreferredSizeChanged method.
301 parent()->SizeToPreferredSize();
302 } 297 }
303 298
304 PermissionSelectorRow::~PermissionSelectorRow() { 299 PermissionSelectorRow::~PermissionSelectorRow() {
305 // Gross. On paper the Combobox and the ComboboxModelAdapter are both owned by 300 // Gross. On paper the Combobox and the ComboboxModelAdapter are both owned by
306 // this class, but actually, the Combobox is owned by View and will be 301 // this class, but actually, the Combobox is owned by View and will be
307 // destroyed in ~View(), which runs *after* ~PermissionSelectorRow() is done, 302 // destroyed in ~View(), which runs *after* ~PermissionSelectorRow() is done,
308 // which means the Combobox gets destroyed after its ComboboxModel, which 303 // which means the Combobox gets destroyed after its ComboboxModel, which
309 // causes an explosion when the Combobox attempts to stop observing the 304 // causes an explosion when the Combobox attempts to stop observing the
310 // ComboboxModel. This hack ensures the Combobox is deleted before its 305 // ComboboxModel. This hack ensures the Combobox is deleted before its
311 // ComboboxModel. 306 // ComboboxModel.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 permission.default_setting, content_settings::SETTING_SOURCE_USER)); 358 permission.default_setting, content_settings::SETTING_SOURCE_USER));
364 menu_button_->SizeToPreferredSize(); 359 menu_button_->SizeToPreferredSize();
365 } else if (combobox_) { 360 } else if (combobox_) {
366 bool use_default = permission.setting == CONTENT_SETTING_DEFAULT; 361 bool use_default = permission.setting == CONTENT_SETTING_DEFAULT;
367 combobox_->UpdateSelectedIndex(use_default); 362 combobox_->UpdateSelectedIndex(use_default);
368 } 363 }
369 364
370 for (PermissionSelectorRowObserver& observer : observer_list_) 365 for (PermissionSelectorRowObserver& observer : observer_list_)
371 observer.OnPermissionChanged(permission); 366 observer.OnPermissionChanged(permission);
372 } 367 }
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