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/browser_shutdown.h" | 5 #include "chrome/browser/browser_shutdown.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 if (restart_last_session) { | 217 if (restart_last_session) { |
218 #if !defined(OS_CHROMEOS) | 218 #if !defined(OS_CHROMEOS) |
219 // Make sure to relaunch the browser with the original command line plus | 219 // Make sure to relaunch the browser with the original command line plus |
220 // the Restore Last Session flag. Note that Chrome can be launched (ie. | 220 // the Restore Last Session flag. Note that Chrome can be launched (ie. |
221 // through ShellExecute on Windows) with a switch argument terminator at | 221 // through ShellExecute on Windows) with a switch argument terminator at |
222 // the end (double dash, as described in b/1366444) plus a URL, | 222 // the end (double dash, as described in b/1366444) plus a URL, |
223 // which prevents us from appending to the command line directly (issue | 223 // which prevents us from appending to the command line directly (issue |
224 // 46182). We therefore use GetSwitches to copy the command line (it stops | 224 // 46182). We therefore use GetSwitches to copy the command line (it stops |
225 // at the switch argument terminator). | 225 // at the switch argument terminator). |
226 CommandLine old_cl(*CommandLine::ForCurrentProcess()); | 226 base::CommandLine old_cl(*base::CommandLine::ForCurrentProcess()); |
227 scoped_ptr<CommandLine> new_cl(new CommandLine(old_cl.GetProgram())); | 227 scoped_ptr<base::CommandLine> new_cl( |
228 std::map<std::string, CommandLine::StringType> switches = | 228 new base::CommandLine(old_cl.GetProgram())); |
| 229 std::map<std::string, base::CommandLine::StringType> switches = |
229 old_cl.GetSwitches(); | 230 old_cl.GetSwitches(); |
230 // Remove the switches that shouldn't persist across restart. | 231 // Remove the switches that shouldn't persist across restart. |
231 about_flags::RemoveFlagsSwitches(&switches); | 232 about_flags::RemoveFlagsSwitches(&switches); |
232 switches::RemoveSwitchesForAutostart(&switches); | 233 switches::RemoveSwitchesForAutostart(&switches); |
233 // Append the old switches to the new command line. | 234 // Append the old switches to the new command line. |
234 for (std::map<std::string, CommandLine::StringType>::const_iterator i = | 235 for ( |
235 switches.begin(); i != switches.end(); ++i) { | 236 std::map<std::string, base::CommandLine::StringType>::const_iterator i = |
236 CommandLine::StringType switch_value = i->second; | 237 switches.begin(); |
| 238 i != switches.end(); ++i) { |
| 239 base::CommandLine::StringType switch_value = i->second; |
237 if (!switch_value.empty()) | 240 if (!switch_value.empty()) |
238 new_cl->AppendSwitchNative(i->first, i->second); | 241 new_cl->AppendSwitchNative(i->first, i->second); |
239 else | 242 else |
240 new_cl->AppendSwitch(i->first); | 243 new_cl->AppendSwitch(i->first); |
241 } | 244 } |
242 | 245 |
243 #if defined(OS_WIN) | 246 #if defined(OS_WIN) |
244 upgrade_util::RelaunchChromeWithMode(*new_cl.get(), g_relaunch_mode); | 247 upgrade_util::RelaunchChromeWithMode(*new_cl.get(), g_relaunch_mode); |
245 #else | 248 #else |
246 upgrade_util::RelaunchChromeBrowser(*new_cl.get()); | 249 upgrade_util::RelaunchChromeBrowser(*new_cl.get()); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 | 334 |
332 void SetTryingToQuit(bool quitting) { | 335 void SetTryingToQuit(bool quitting) { |
333 g_trying_to_quit = quitting; | 336 g_trying_to_quit = quitting; |
334 } | 337 } |
335 | 338 |
336 bool IsTryingToQuit() { | 339 bool IsTryingToQuit() { |
337 return g_trying_to_quit; | 340 return g_trying_to_quit; |
338 } | 341 } |
339 | 342 |
340 } // namespace browser_shutdown | 343 } // namespace browser_shutdown |
OLD | NEW |