| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/browser_window_state.h" | 5 #include "chrome/browser/ui/browser_window_state.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 DCHECK(show_state); | 133 DCHECK(show_state); |
| 134 *bounds = browser->override_bounds(); | 134 *bounds = browser->override_bounds(); |
| 135 WindowSizer::GetBrowserWindowBoundsAndShowState(browser->app_name(), | 135 WindowSizer::GetBrowserWindowBoundsAndShowState(browser->app_name(), |
| 136 *bounds, | 136 *bounds, |
| 137 browser, | 137 browser, |
| 138 bounds, | 138 bounds, |
| 139 show_state); | 139 show_state); |
| 140 | 140 |
| 141 const base::CommandLine& parsed_command_line = | 141 const base::CommandLine& parsed_command_line = |
| 142 *base::CommandLine::ForCurrentProcess(); | 142 *base::CommandLine::ForCurrentProcess(); |
| 143 bool record_mode = parsed_command_line.HasSwitch(switches::kRecordMode); | |
| 144 bool playback_mode = parsed_command_line.HasSwitch(switches::kPlaybackMode); | |
| 145 if (record_mode || playback_mode) { | |
| 146 // In playback/record mode we always fix the size of the browser and | |
| 147 // move it to (0,0). The reason for this is two reasons: First we want | |
| 148 // resize/moves in the playback to still work, and Second we want | |
| 149 // playbacks to work (as much as possible) on machines w/ different | |
| 150 // screen sizes. | |
| 151 *bounds = gfx::Rect(0, 0, 800, 600); | |
| 152 } | |
| 153 | 143 |
| 154 // The following options override playback/record. | |
| 155 if (parsed_command_line.HasSwitch(switches::kWindowSize)) { | 144 if (parsed_command_line.HasSwitch(switches::kWindowSize)) { |
| 156 std::string str = | 145 std::string str = |
| 157 parsed_command_line.GetSwitchValueASCII(switches::kWindowSize); | 146 parsed_command_line.GetSwitchValueASCII(switches::kWindowSize); |
| 158 int width, height; | 147 int width, height; |
| 159 if (ParseCommaSeparatedIntegers(str, &width, &height)) | 148 if (ParseCommaSeparatedIntegers(str, &width, &height)) |
| 160 bounds->set_size(gfx::Size(width, height)); | 149 bounds->set_size(gfx::Size(width, height)); |
| 161 } | 150 } |
| 162 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { | 151 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { |
| 163 std::string str = | 152 std::string str = |
| 164 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); | 153 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); |
| 165 int x, y; | 154 int x, y; |
| 166 if (ParseCommaSeparatedIntegers(str, &x, &y)) | 155 if (ParseCommaSeparatedIntegers(str, &x, &y)) |
| 167 bounds->set_origin(gfx::Point(x, y)); | 156 bounds->set_origin(gfx::Point(x, y)); |
| 168 } | 157 } |
| 169 } | 158 } |
| 170 | 159 |
| 171 } // namespace chrome | 160 } // namespace chrome |
| OLD | NEW |