| Index: apps/shell_window.cc
|
| diff --git a/apps/shell_window.cc b/apps/shell_window.cc
|
| index 3fd2314f28fa1dc7f1889c1157c0e265b1d0d456..6bcaaf89170eee53857bec407666f30d8cdbdca6 100644
|
| --- a/apps/shell_window.cc
|
| +++ b/apps/shell_window.cc
|
| @@ -108,7 +108,9 @@ void ShellWindow::Init(const GURL& url,
|
| // If left and top are left undefined, the native shell window will center
|
| // the window on the main screen in a platform-defined manner.
|
|
|
| - ui::WindowShowState cached_state = ui::SHOW_STATE_DEFAULT;
|
| + CreateParams new_params = params;
|
| +
|
| + // Load cached state if it exists.
|
| if (!params.window_key.empty()) {
|
| window_key_ = params.window_key;
|
|
|
| @@ -116,26 +118,19 @@ void ShellWindow::Init(const GURL& url,
|
|
|
| gfx::Rect cached_bounds;
|
| gfx::Rect cached_screen_bounds;
|
| + ui::WindowShowState cached_state = ui::SHOW_STATE_DEFAULT;
|
| if (cache->GetGeometry(extension()->id(), params.window_key, &cached_bounds,
|
| &cached_screen_bounds, &cached_state)) {
|
| - bounds = cached_bounds;
|
| // App window has cached screen bounds, make sure it fits on screen in
|
| // case the screen resolution changed.
|
| - if (!cached_screen_bounds.IsEmpty()) {
|
| - gfx::Screen* screen = gfx::Screen::GetNativeScreen();
|
| - gfx::Display display = screen->GetDisplayMatching(cached_bounds);
|
| - gfx::Rect current_screen_bounds = display.work_area();
|
| - AdjustBoundsToBeVisibleOnScreen(cached_bounds,
|
| - cached_screen_bounds,
|
| - current_screen_bounds,
|
| - params.minimum_size,
|
| - &bounds);
|
| - }
|
| + AdjustBoundsToBeVisibleOnScreen(cached_bounds,
|
| + cached_screen_bounds,
|
| + params.minimum_size,
|
| + &bounds);
|
| + new_params.state = cached_state;
|
| }
|
| }
|
|
|
| - CreateParams new_params = params;
|
| -
|
| gfx::Size& minimum_size = new_params.minimum_size;
|
| gfx::Size& maximum_size = new_params.maximum_size;
|
|
|
| @@ -158,9 +153,6 @@ void ShellWindow::Init(const GURL& url,
|
|
|
| new_params.bounds = bounds;
|
|
|
| - if (cached_state != ui::SHOW_STATE_DEFAULT)
|
| - new_params.state = cached_state;
|
| -
|
| native_app_window_.reset(NativeAppWindow::Create(this, new_params));
|
|
|
| if (!new_params.hidden) {
|
| @@ -586,19 +578,18 @@ void ShellWindow::SaveWindowPosition() {
|
| void ShellWindow::AdjustBoundsToBeVisibleOnScreen(
|
| const gfx::Rect& cached_bounds,
|
| const gfx::Rect& cached_screen_bounds,
|
| - const gfx::Rect& current_screen_bounds,
|
| const gfx::Size& minimum_size,
|
| gfx::Rect* bounds) const {
|
| - if (!bounds)
|
| - return;
|
| -
|
| *bounds = cached_bounds;
|
|
|
| + gfx::Screen* screen = gfx::Screen::GetNativeScreen();
|
| + gfx::Display display = screen->GetDisplayMatching(cached_bounds);
|
| + gfx::Rect current_screen_bounds = display.work_area();
|
| +
|
| // Reposition and resize the bounds if the cached_screen_bounds is different
|
| // from the current screen bounds and the current screen bounds doesn't
|
| // completely contain the bounds.
|
| - if (!cached_screen_bounds.IsEmpty() &&
|
| - cached_screen_bounds != current_screen_bounds &&
|
| + if (cached_screen_bounds != current_screen_bounds &&
|
| !current_screen_bounds.Contains(cached_bounds)) {
|
| bounds->set_width(
|
| std::max(minimum_size.width(),
|
|
|