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 |