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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 DCHECK(browser); | 131 DCHECK(browser); |
132 DCHECK(bounds); | 132 DCHECK(bounds); |
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 CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 141 const base::CommandLine& parsed_command_line = |
| 142 *base::CommandLine::ForCurrentProcess(); |
142 bool record_mode = parsed_command_line.HasSwitch(switches::kRecordMode); | 143 bool record_mode = parsed_command_line.HasSwitch(switches::kRecordMode); |
143 bool playback_mode = parsed_command_line.HasSwitch(switches::kPlaybackMode); | 144 bool playback_mode = parsed_command_line.HasSwitch(switches::kPlaybackMode); |
144 if (record_mode || playback_mode) { | 145 if (record_mode || playback_mode) { |
145 // In playback/record mode we always fix the size of the browser and | 146 // In playback/record mode we always fix the size of the browser and |
146 // move it to (0,0). The reason for this is two reasons: First we want | 147 // move it to (0,0). The reason for this is two reasons: First we want |
147 // resize/moves in the playback to still work, and Second we want | 148 // resize/moves in the playback to still work, and Second we want |
148 // playbacks to work (as much as possible) on machines w/ different | 149 // playbacks to work (as much as possible) on machines w/ different |
149 // screen sizes. | 150 // screen sizes. |
150 *bounds = gfx::Rect(0, 0, 800, 600); | 151 *bounds = gfx::Rect(0, 0, 800, 600); |
151 } | 152 } |
152 | 153 |
153 // The following options override playback/record. | 154 // The following options override playback/record. |
154 if (parsed_command_line.HasSwitch(switches::kWindowSize)) { | 155 if (parsed_command_line.HasSwitch(switches::kWindowSize)) { |
155 std::string str = | 156 std::string str = |
156 parsed_command_line.GetSwitchValueASCII(switches::kWindowSize); | 157 parsed_command_line.GetSwitchValueASCII(switches::kWindowSize); |
157 int width, height; | 158 int width, height; |
158 if (ParseCommaSeparatedIntegers(str, &width, &height)) | 159 if (ParseCommaSeparatedIntegers(str, &width, &height)) |
159 bounds->set_size(gfx::Size(width, height)); | 160 bounds->set_size(gfx::Size(width, height)); |
160 } | 161 } |
161 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { | 162 if (parsed_command_line.HasSwitch(switches::kWindowPosition)) { |
162 std::string str = | 163 std::string str = |
163 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); | 164 parsed_command_line.GetSwitchValueASCII(switches::kWindowPosition); |
164 int x, y; | 165 int x, y; |
165 if (ParseCommaSeparatedIntegers(str, &x, &y)) | 166 if (ParseCommaSeparatedIntegers(str, &x, &y)) |
166 bounds->set_origin(gfx::Point(x, y)); | 167 bounds->set_origin(gfx::Point(x, y)); |
167 } | 168 } |
168 } | 169 } |
169 | 170 |
170 } // namespace chrome | 171 } // namespace chrome |
OLD | NEW |