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

Unified Diff: chrome/browser/ui/window_sizer/window_sizer_ash.cc

Issue 23567007: More cleanup in window_sizer/window_sizer_ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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: chrome/browser/ui/window_sizer/window_sizer_ash.cc
diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash.cc b/chrome/browser/ui/window_sizer/window_sizer_ash.cc
index aa8b535972ccad1d26db9d3e3262d1f8b58e0e18..22323dc6af4e872b208d213f7600326774ce271a 100644
--- a/chrome/browser/ui/window_sizer/window_sizer_ash.cc
+++ b/chrome/browser/ui/window_sizer/window_sizer_ash.cc
@@ -89,27 +89,17 @@ int WindowSizer::GetForceMaximizedWidthLimit() {
return maximum_limit;
}
-bool WindowSizer::GetBoundsOverrideAsh(gfx::Rect* bounds_in_screen,
+void WindowSizer::GetBoundsOverrideAsh(gfx::Rect* bounds_in_screen,
ui::WindowShowState* show_state) const {
Mr4D (OOO till 08-26) 2013/09/03 15:55:03 Since you have changed the meaning of the function
oshima 2013/09/03 18:15:27 Changed to GetTabbedBrowserBoundsAsh
DCHECK(show_state);
DCHECK(bounds_in_screen);
+ DCHECK(!browser_ || browser_->is_type_tabbed());
- if (browser_ &&
- browser_->host_desktop_type() != chrome::HOST_DESKTOP_TYPE_ASH) {
- return false;
- }
bounds_in_screen->SetRect(0, 0, 0, 0);
- // Experiment: Force the maximize mode for all windows.
- if (ash::Shell::IsForcedMaximizeMode()) {
- // Exceptions: Do not maximize popups and do not maximize windowed V1 apps
- // which explicitly specify a |show_state| (they might be tuned for a
- // particular resolution / type).
- bool is_tabbed = browser_ && browser_->is_type_tabbed();
- bool is_popup = browser_ && browser_->is_type_popup();
- if (!is_popup && (is_tabbed || *show_state == ui::SHOW_STATE_DEFAULT))
- *show_state = ui::SHOW_STATE_MAXIMIZED;
- }
+ // Experiment: Force the maximize mode for all tabbed windows
+ if (ash::Shell::IsForcedMaximizeMode())
+ *show_state = ui::SHOW_STATE_MAXIMIZED;
ui::WindowShowState passed_show_state = *show_state;
bool has_saved_bounds = true;
@@ -118,56 +108,46 @@ bool WindowSizer::GetBoundsOverrideAsh(gfx::Rect* bounds_in_screen,
GetDefaultWindowBounds(bounds_in_screen);
}
- if (browser_ && browser_->is_type_tabbed()) {
- aura::RootWindow* active = ash::Shell::GetActiveRootWindow();
- // Always open new window in the active display.
- gfx::Rect work_area =
- screen_->GetDisplayMatching(active->GetBoundsInScreen()).work_area();
-
- // This is a window / app. See if there is no window and try to place it.
- int count = GetNumberOfValidTopLevelBrowserWindows(work_area);
- aura::Window* top_window = ash::GetTopWindowForNewWindow(active);
- // Our window should not have any impact if we are already on top.
- if (browser_->window() &&
- top_window == browser_->window()->GetNativeWindow())
- top_window = NULL;
-
- // If there is no valid other window we take the coordinates as is.
- if ((!count || !top_window)) {
- if (has_saved_bounds) {
- // Restore to previous state - if there is one.
- bounds_in_screen->AdjustToFit(work_area);
- return true;
- }
- // When using "small screens" we want to always open in full screen mode.
- if (passed_show_state == ui::SHOW_STATE_DEFAULT &&
- !browser_->is_session_restore() &&
- work_area.width() <= GetForceMaximizedWidthLimit() &&
- (!browser_->window() || !browser_->window()->IsFullscreen()) &&
- (!browser_->fullscreen_controller() ||
- !browser_->fullscreen_controller()->IsFullscreenForBrowser()))
- *show_state = ui::SHOW_STATE_MAXIMIZED;
- return true;
- }
- bool maximized = ash::wm::IsWindowMaximized(top_window);
- // We ignore the saved show state, but look instead for the top level
- // window's show state.
- if (passed_show_state == ui::SHOW_STATE_DEFAULT) {
- *show_state = maximized ? ui::SHOW_STATE_MAXIMIZED :
- ui::SHOW_STATE_DEFAULT;
+ aura::RootWindow* active = ash::Shell::GetActiveRootWindow();
+ // Always open new window in the active display.
+ gfx::Rect work_area =
+ screen_->GetDisplayMatching(active->GetBoundsInScreen()).work_area();
+
+ // This is a window / app. See if there is no window and try to place it.
+ int count = GetNumberOfValidTopLevelBrowserWindows(work_area);
+ aura::Window* top_window = ash::GetTopWindowForNewWindow(active);
+ // Our window should not have any impact if we are already on top.
+ if (browser_->window() &&
+ top_window == browser_->window()->GetNativeWindow())
+ top_window = NULL;
+
+ // If there is no valid other window we take the coordinates as is.
+ if ((!count || !top_window)) {
+ if (has_saved_bounds) {
+ // Restore to previous state - if there is one.
+ bounds_in_screen->AdjustToFit(work_area);
+ return;
}
- if (maximized)
- return true;
-
- // Use the size of the other window. The window's bound will be rearranged
- // in ash::WorkspaceLayoutManager using this location.
- *bounds_in_screen = top_window->GetBoundsInScreen();
-
- return true;
+ // When using "small screens" we want to always open in full screen mode.
+ if (passed_show_state == ui::SHOW_STATE_DEFAULT &&
+ !browser_->is_session_restore() &&
+ work_area.width() <= GetForceMaximizedWidthLimit() &&
+ (!browser_->window() || !browser_->window()->IsFullscreen()))
Mr4D (OOO till 08-26) 2013/09/03 15:55:03 I know you asked me about the fullscreen controlle
oshima 2013/09/03 18:15:27 Yes, i'm pretty sure this isn't necessary. (you ca
+ *show_state = ui::SHOW_STATE_MAXIMIZED;
+ return;
+ }
+ bool maximized = ash::wm::IsWindowMaximized(top_window);
+ // We ignore the saved show state, but look instead for the top level
+ // window's show state.
+ if (passed_show_state == ui::SHOW_STATE_DEFAULT) {
+ *show_state = maximized ? ui::SHOW_STATE_MAXIMIZED :
+ ui::SHOW_STATE_DEFAULT;
}
- return false;
+ // Use the size of the other window. The window's bound will be rearranged
+ // in ash::WorkspaceLayoutManager using this location.
+ *bounds_in_screen = top_window->GetBoundsInScreen();
}
void WindowSizer::GetDefaultWindowBoundsAsh(gfx::Rect* default_bounds) const {

Powered by Google App Engine
This is Rietveld 408576698