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

Unified Diff: chrome/browser/ui/browser_window_state.cc

Issue 11072002: Combined window positioning and show state determiniation in the WindowSizer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed more build issues Created 8 years, 2 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/browser_window_state.cc
diff --git a/chrome/browser/ui/browser_window_state.cc b/chrome/browser/ui/browser_window_state.cc
index 9c0d48c9e74e2578da49b09171019a91a45b5633..f57c696367c865b3f17f998947134c5fad24b387 100644
--- a/chrome/browser/ui/browser_window_state.cc
+++ b/chrome/browser/ui/browser_window_state.cc
@@ -80,12 +80,17 @@ void SaveWindowPlacement(const Browser* browser,
session_service->SetWindowBounds(browser->session_id(), bounds, show_state);
}
-gfx::Rect GetSavedWindowBounds(const Browser* browser) {
- gfx::Rect restored_bounds = browser->override_bounds();
- WindowSizer::GetBrowserWindowBounds(browser->app_name(),
- restored_bounds,
- browser,
- &restored_bounds);
+void GetSavedWindowBoundsAndShowState(const Browser* browser,
+ gfx::Rect* bounds,
+ ui::WindowShowState* show_state) {
+ DCHECK(bounds);
+ DCHECK(show_state);
+ *bounds = browser->override_bounds();
+ WindowSizer::GetBrowserWindowBoundsAndShowState(browser->app_name(),
+ *bounds,
+ browser,
+ bounds,
+ show_state);
const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
bool record_mode = parsed_command_line.HasSwitch(switches::kRecordMode);
@@ -96,7 +101,7 @@ gfx::Rect GetSavedWindowBounds(const Browser* browser) {
// resize/moves in the playback to still work, and Second we want
// playbacks to work (as much as possible) on machines w/ different
// screen sizes.
- restored_bounds = gfx::Rect(0, 0, 800, 600);
+ *bounds = gfx::Rect(0, 0, 800, 600);
}
// The following options override playback/record.
@@ -105,44 +110,15 @@ gfx::Rect GetSavedWindowBounds(const Browser* browser) {
parsed_command_line.GetSwitchValueASCII(switches::kWindowSize);
int width, height;
if (ParseCommaSeparatedIntegers(str, &width, &height))
- restored_bounds.set_size(gfx::Size(width, height));
+ bounds->set_size(gfx::Size(width, height));
}
if (parsed_command_line.HasSwitch(switches::kWindowPosition)) {
std::string str =
parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition);
int x, y;
if (ParseCommaSeparatedIntegers(str, &x, &y))
- restored_bounds.set_origin(gfx::Point(x, y));
+ bounds->set_origin(gfx::Point(x, y));
}
-
- return restored_bounds;
-}
-
-ui::WindowShowState GetSavedWindowShowState(const Browser* browser) {
- // Only tabbed browsers use the command line or preference state, with the
- // exception of devtools.
- bool show_state = !browser->is_type_tabbed() && !browser->is_devtools();
-
-#if defined(USE_AURA)
- // Apps save state on aura.
- show_state &= !browser->is_app();
-#endif
-
- if (show_state)
- return browser->initial_show_state();
-
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized))
- return ui::SHOW_STATE_MAXIMIZED;
-
- if (browser->initial_show_state() != ui::SHOW_STATE_DEFAULT)
- return browser->initial_show_state();
-
- const DictionaryValue* window_pref = browser->profile()->GetPrefs()->
- GetDictionary(GetWindowPlacementKey(browser).c_str());
- bool maximized = false;
- window_pref->GetBoolean("maximized", &maximized);
-
- return maximized ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_DEFAULT;
}
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698