From e1b62b7f2241bc2feb8696a9f65e46438dbce64b Mon Sep 17 00:00:00 2001 From: "erg@chromium.org" Date: Tue, 20 May 2014 17:24:44 +0000 Subject: views: Make view::Views::GetPreferredSize() const. Due to button refactoring patches, we now need to ask views for their preferred sizes in const methods. Across the entire codebase, the overwhelming majority of GetPreferredSize() implementations could be const. There are only a few places where we can't, and they are usually combining the sizing and layout code. BookmarksBarView was simple enough to perform this separation. Most of the other places were solved by adding "mutable" to value caches. BUG=155363 R=jam@chromium.org, pkasting@chromium.org, scheib@chromium.org, sky@chromium.org, pkasting, sky TBR=jam, scheib Review URL: https://codereview.chromium.org/273223002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271682 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/shell/lock_view.cc | 2 +- ash/shell/panel_window.cc | 2 +- ash/shell/panel_window.h | 2 +- ash/shell/widgets.cc | 4 ++-- ash/shell/window_type_launcher.cc | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'ash/shell') diff --git a/ash/shell/lock_view.cc b/ash/shell/lock_view.cc index d14b593..ed2e75d 100644 --- a/ash/shell/lock_view.cc +++ b/ash/shell/lock_view.cc @@ -35,7 +35,7 @@ class LockView : public views::WidgetDelegateView, virtual ~LockView() {} // Overridden from views::View: - virtual gfx::Size GetPreferredSize() OVERRIDE { + virtual gfx::Size GetPreferredSize() const OVERRIDE { return gfx::Size(500, 400); } diff --git a/ash/shell/panel_window.cc b/ash/shell/panel_window.cc index 0cd5a25..3a197a3 100644 --- a/ash/shell/panel_window.cc +++ b/ash/shell/panel_window.cc @@ -57,7 +57,7 @@ views::Widget* PanelWindow::CreateWidget() { return widget; } -gfx::Size PanelWindow::GetPreferredSize() { +gfx::Size PanelWindow::GetPreferredSize() const { return gfx::Size(kMinWidth, kMinHeight); } diff --git a/ash/shell/panel_window.h b/ash/shell/panel_window.h index eefe5e3..2d3a0bd 100644 --- a/ash/shell/panel_window.h +++ b/ash/shell/panel_window.h @@ -33,7 +33,7 @@ class PanelWindow : public views::WidgetDelegateView { private: // Overridden from views::View: - virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual gfx::Size GetPreferredSize() const OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; // Overridden from views::WidgetDelegate: diff --git a/ash/shell/widgets.cc b/ash/shell/widgets.cc index 7a71eb8..09b192a 100644 --- a/ash/shell/widgets.cc +++ b/ash/shell/widgets.cc @@ -32,7 +32,7 @@ class WidgetsWindow : public views::WidgetDelegateView { // Overridden from views::View: virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual void Layout() OVERRIDE; - virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual gfx::Size GetPreferredSize() const OVERRIDE; // Overridden from views::WidgetDelegate: virtual views::View* GetContentsView() OVERRIDE; @@ -113,7 +113,7 @@ void WidgetsWindow::Layout() { } } -gfx::Size WidgetsWindow::GetPreferredSize() { +gfx::Size WidgetsWindow::GetPreferredSize() const { return gfx::Size(kWindowWidth, kWindowHeight); } diff --git a/ash/shell/window_type_launcher.cc b/ash/shell/window_type_launcher.cc index 61ba3fa..a84b4cb 100644 --- a/ash/shell/window_type_launcher.cc +++ b/ash/shell/window_type_launcher.cc @@ -76,7 +76,7 @@ class ModalWindow : public views::WidgetDelegateView, virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { canvas->FillRect(GetLocalBounds(), color_); } - virtual gfx::Size GetPreferredSize() OVERRIDE { + virtual gfx::Size GetPreferredSize() const OVERRIDE { return gfx::Size(200, 200); } virtual void Layout() OVERRIDE { @@ -148,7 +148,7 @@ class NonModalTransient : public views::WidgetDelegateView { virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { canvas->FillRect(GetLocalBounds(), color_); } - virtual gfx::Size GetPreferredSize() OVERRIDE { + virtual gfx::Size GetPreferredSize() const OVERRIDE { return gfx::Size(250, 250); } -- cgit v1.1