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

Unified Diff: ash/wm/window_positioner.cc

Issue 964503002: Implemented ForceMaximizeBrowserWindowOnFirstRun policy, added unit test and browser test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed description Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/window_positioner.cc
diff --git a/ash/wm/window_positioner.cc b/ash/wm/window_positioner.cc
index 4e80ed84a8602a33efee583617fe3fe4f5077df2..db236b91b8ea3771be7306de2e6ee3253083a1ef 100644
--- a/ash/wm/window_positioner.cc
+++ b/ash/wm/window_positioner.cc
@@ -6,6 +6,7 @@
#include "ash/screen_util.h"
#include "ash/shell.h"
+#include "ash/shell_delegate.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/window_resizer.h"
@@ -246,7 +247,6 @@ void WindowPositioner::GetBoundsAndShowStateForNewWindow(
ui::WindowShowState show_state_in,
gfx::Rect* bounds_in_out,
ui::WindowShowState* show_state_out) {
-
// Always open new window in the target display.
aura::Window* target = Shell::GetTargetRootWindow();
@@ -264,14 +264,23 @@ void WindowPositioner::GetBoundsAndShowStateForNewWindow(
// Use adjusted saved bounds, if there is one.
if (is_saved_bounds)
return;
- // When using "small screens" we want to always open in full screen mode.
- if (show_state_in == ui::SHOW_STATE_DEFAULT && (maximize_first_window ||
- (work_area.width() <= GetForceMaximizedWidthLimit() &&
- (!new_window || !wm::GetWindowState(new_window)->IsFullscreen())))) {
+
+ // Policy to maximize window on the first run works only for Chrome OS.
bartfab (slow) 2015/03/12 11:54:43 Nit: No need for this comment. Ash is cross-plafor
peletskyi 2015/03/18 13:28:09 Done.
+ const bool maximized_first_run =
bartfab (slow) 2015/03/12 11:54:43 1: Nit: How about s/maximized_first_run/maximize_f
peletskyi 2015/03/18 13:28:09 Done.
+ Shell::GetInstance()->delegate()->IsFirstTimeMaximized();
+ // When using "small screens" we want to always open in full screen mode,
bartfab (slow) 2015/03/12 11:54:43 Nit: How about "We want to always open maximized o
peletskyi 2015/03/18 13:28:09 Done.
+ // or when the policy ForceMaximizeBrowserWindowOnFirstRun is set to true.
+ const bool set_maximized =
+ maximize_first_window ||
+ ((work_area.width() <= GetForceMaximizedWidthLimit() ||
+ maximized_first_run) &&
bartfab (slow) 2015/03/12 11:54:43 Where is the code that ensures we only enforce thi
+ (!new_window || !wm::GetWindowState(new_window)->IsFullscreen()));
+ if (show_state_in == ui::SHOW_STATE_DEFAULT && set_maximized) {
bartfab (slow) 2015/03/12 11:54:43 Nit: You should rearrange this so that |set_maximi
peletskyi 2015/03/18 13:28:09 Done.
*show_state_out = ui::SHOW_STATE_MAXIMIZED;
}
return;
}
+
wm::WindowState* top_window_state = wm::GetWindowState(top_window);
bool maximized = top_window_state->IsMaximized();
// We ignore the saved show state, but look instead for the top level

Powered by Google App Engine
This is Rietveld 408576698