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

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

Issue 2844843002: Override MAXIMIZED window show state if window size / position is manually specified. (Closed)
Patch Set: Added missing unittest file. Created 3 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 | « chrome/browser/ui/browser_window_state.h ('k') | chrome/browser/ui/browser_window_state_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 54f3544c32cf78f42ed58861a29041652289e99a..ff1b5198a7f6b123410726d2aab85f2ace70106f 100644
--- a/chrome/browser/ui/browser_window_state.cc
+++ b/chrome/browser/ui/browser_window_state.cc
@@ -161,20 +161,38 @@ void GetSavedWindowBoundsAndShowState(const Browser* browser,
const base::CommandLine& parsed_command_line =
*base::CommandLine::ForCurrentProcess();
- if (parsed_command_line.HasSwitch(switches::kWindowSize)) {
- std::string str =
- parsed_command_line.GetSwitchValueASCII(switches::kWindowSize);
+ internal::UpdateWindowBoundsAndShowStateFromCommandLine(parsed_command_line,
+ bounds, show_state);
+}
+
+namespace internal {
+
+void UpdateWindowBoundsAndShowStateFromCommandLine(
+ const base::CommandLine& command_line,
+ gfx::Rect* bounds,
+ ui::WindowShowState* show_state) {
+ // Allow command-line flags to override the window size and position. If
+ // either of these is specified then set the show state to NORMAL so that
+ // they are immediately respected.
+ if (command_line.HasSwitch(switches::kWindowSize)) {
+ std::string str = command_line.GetSwitchValueASCII(switches::kWindowSize);
int width, height;
- if (ParseCommaSeparatedIntegers(str, &width, &height))
+ if (ParseCommaSeparatedIntegers(str, &width, &height)) {
bounds->set_size(gfx::Size(width, height));
+ *show_state = ui::SHOW_STATE_NORMAL;
+ }
}
- if (parsed_command_line.HasSwitch(switches::kWindowPosition)) {
+ if (command_line.HasSwitch(switches::kWindowPosition)) {
std::string str =
- parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition);
+ command_line.GetSwitchValueASCII(switches::kWindowPosition);
int x, y;
- if (ParseCommaSeparatedIntegers(str, &x, &y))
+ if (ParseCommaSeparatedIntegers(str, &x, &y)) {
bounds->set_origin(gfx::Point(x, y));
+ *show_state = ui::SHOW_STATE_NORMAL;
+ }
}
}
+} // namespace internal
+
} // namespace chrome
« no previous file with comments | « chrome/browser/ui/browser_window_state.h ('k') | chrome/browser/ui/browser_window_state_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698