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

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: Created 5 years, 8 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
« no previous file with comments | « ash/test/test_shell_delegate.cc ('k') | ash/wm/window_positioner_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_positioner.cc
diff --git a/ash/wm/window_positioner.cc b/ash/wm/window_positioner.cc
index 4e80ed84a8602a33efee583617fe3fe4f5077df2..eed15a053525596e4b47969a4ff2ee264ae757d5 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,24 @@ 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())))) {
- *show_state_out = ui::SHOW_STATE_MAXIMIZED;
+
+ if (show_state_in == ui::SHOW_STATE_DEFAULT) {
+ const bool maximize_first_window_on_first_run =
+ Shell::GetInstance()->delegate()->IsForceMaximizeOnFirstRun();
+ // We want to always open maximized on "small screens" or when policy
+ // tells us to.
+ const bool set_maximized =
+ maximize_first_window ||
+ ((work_area.width() <= GetForceMaximizedWidthLimit() ||
+ maximize_first_window_on_first_run) &&
+ (!new_window || !wm::GetWindowState(new_window)->IsFullscreen()));
+
+ if (set_maximized)
+ *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
« no previous file with comments | « ash/test/test_shell_delegate.cc ('k') | ash/wm/window_positioner_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698