Commit 20781a35 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

views: remove WidgetDelegate::ShouldRestoreWindowSize

This method has no overrides and always returns true. This change
removes it, removes the only call to it, and simplifies code around
that call site as a result.

Bug: None
Change-Id: I2c5b13552923f11615e5b2e629fc2da70fb26eb8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2367650
Commit-Queue: Robert Liao <robliao@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800426}
parent a4017fb6
...@@ -1599,22 +1599,17 @@ bool Widget::GetSavedWindowPlacement(gfx::Rect* bounds, ...@@ -1599,22 +1599,17 @@ bool Widget::GetSavedWindowPlacement(gfx::Rect* bounds,
// a window is restored from maximized state, so we can't more accurately // a window is restored from maximized state, so we can't more accurately
// track maximized state independently of sizing information. // track maximized state independently of sizing information.
// Restore the window's placement from the controller. if (!widget_delegate_->GetSavedWindowPlacement(this, bounds, show_state))
if (widget_delegate_->GetSavedWindowPlacement(this, bounds, show_state)) { return false;
if (!widget_delegate_->ShouldRestoreWindowSize()) {
bounds->set_size(non_client_view_->GetPreferredSize());
} else {
gfx::Size minimum_size = GetMinimumSize();
// Make sure the bounds are at least the minimum size.
if (bounds->width() < minimum_size.width())
bounds->set_width(minimum_size.width());
if (bounds->height() < minimum_size.height()) gfx::Size minimum_size = GetMinimumSize();
bounds->set_height(minimum_size.height()); // Make sure the bounds are at least the minimum size.
} if (bounds->width() < minimum_size.width())
return true; bounds->set_width(minimum_size.width());
}
return false; if (bounds->height() < minimum_size.height())
bounds->set_height(minimum_size.height());
return true;
} }
const View::Views& Widget::GetViewsWithLayers() { const View::Views& Widget::GetViewsWithLayers() {
......
...@@ -153,10 +153,6 @@ bool WidgetDelegate::GetSavedWindowPlacement( ...@@ -153,10 +153,6 @@ bool WidgetDelegate::GetSavedWindowPlacement(
return display.bounds().Intersects(*bounds); return display.bounds().Intersects(*bounds);
} }
bool WidgetDelegate::ShouldRestoreWindowSize() const {
return true;
}
void WidgetDelegate::WidgetInitializing(Widget* widget) { void WidgetDelegate::WidgetInitializing(Widget* widget) {
widget_ = widget; widget_ = widget;
OnWidgetInitializing(); OnWidgetInitializing();
......
...@@ -178,12 +178,6 @@ class VIEWS_EXPORT WidgetDelegate { ...@@ -178,12 +178,6 @@ class VIEWS_EXPORT WidgetDelegate {
gfx::Rect* bounds, gfx::Rect* bounds,
ui::WindowShowState* show_state) const; ui::WindowShowState* show_state) const;
// Returns true if the window's size should be restored. If this is false,
// only the window's origin is restored and the window is given its
// preferred size.
// Default is true.
virtual bool ShouldRestoreWindowSize() const;
// Hooks for the end of the Widget/Window lifecycle. As of this writing, these // Hooks for the end of the Widget/Window lifecycle. As of this writing, these
// callbacks happen like so: // callbacks happen like so:
// 1. Client code calls Widget::CloseWithReason() // 1. Client code calls Widget::CloseWithReason()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment