OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 7 #include <string> |
8 | 8 |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/metrics/metrics_service.h" | 26 #include "chrome/browser/metrics/metrics_service.h" |
27 #include "chrome/browser/plugin_process_host.h" | 27 #include "chrome/browser/plugin_process_host.h" |
28 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
29 #include "chrome/browser/renderer_host/render_process_host.h" | 29 #include "chrome/browser/renderer_host/render_process_host.h" |
30 #include "chrome/browser/renderer_host/render_view_host.h" | 30 #include "chrome/browser/renderer_host/render_view_host.h" |
31 #include "chrome/browser/renderer_host/render_widget_host.h" | 31 #include "chrome/browser/renderer_host/render_widget_host.h" |
32 #include "chrome/common/chrome_paths.h" | 32 #include "chrome/common/chrome_paths.h" |
33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
35 #include "chrome/common/chrome_plugin_lib.h" | 35 #include "chrome/common/chrome_plugin_lib.h" |
| 36 #include "chrome/common/switch_utils.h" |
36 #include "net/predictor_api.h" | 37 #include "net/predictor_api.h" |
37 | 38 |
38 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
39 #include "chrome/browser/rlz/rlz.h" | 40 #include "chrome/browser/rlz/rlz.h" |
40 #endif | 41 #endif |
41 | 42 |
42 using base::Time; | 43 using base::Time; |
43 using base::TimeDelta; | 44 using base::TimeDelta; |
44 | 45 |
45 namespace browser_shutdown { | 46 namespace browser_shutdown { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // the Restore Last Session flag. Note that Chrome can be launched (ie. | 170 // the Restore Last Session flag. Note that Chrome can be launched (ie. |
170 // through ShellExecute on Windows) with a switch argument terminator at | 171 // through ShellExecute on Windows) with a switch argument terminator at |
171 // the end (double dash, as described in b/1366444) plus a URL, | 172 // the end (double dash, as described in b/1366444) plus a URL, |
172 // which prevents us from appending to the command line directly (issue | 173 // which prevents us from appending to the command line directly (issue |
173 // 46182). We therefore use GetSwitches to copy the command line (it stops | 174 // 46182). We therefore use GetSwitches to copy the command line (it stops |
174 // at the switch argument terminator). | 175 // at the switch argument terminator). |
175 CommandLine old_cl(*CommandLine::ForCurrentProcess()); | 176 CommandLine old_cl(*CommandLine::ForCurrentProcess()); |
176 scoped_ptr<CommandLine> new_cl(new CommandLine(old_cl.GetProgram())); | 177 scoped_ptr<CommandLine> new_cl(new CommandLine(old_cl.GetProgram())); |
177 std::map<std::string, CommandLine::StringType> switches = | 178 std::map<std::string, CommandLine::StringType> switches = |
178 old_cl.GetSwitches(); | 179 old_cl.GetSwitches(); |
| 180 // Remove the switches that shouldn't persist across restart. |
| 181 switches::RemoveSwitchesForAutostart(&switches); |
179 // Append the old switches to the new command line. | 182 // Append the old switches to the new command line. |
180 for (std::map<std::string, CommandLine::StringType>::const_iterator i = | 183 for (std::map<std::string, CommandLine::StringType>::const_iterator i = |
181 switches.begin(); i != switches.end(); ++i) { | 184 switches.begin(); i != switches.end(); ++i) { |
182 CommandLine::StringType switch_value = i->second; | 185 CommandLine::StringType switch_value = i->second; |
183 if (!switch_value.empty()) | 186 if (!switch_value.empty()) |
184 new_cl->AppendSwitchNative(i->first, i->second); | 187 new_cl->AppendSwitchNative(i->first, i->second); |
185 else | 188 else |
186 new_cl->AppendSwitch(i->first); | 189 new_cl->AppendSwitch(i->first); |
187 } | 190 } |
188 // Ensure restore last session is set. | 191 // Ensure restore last session is set. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 294 |
292 bool ShuttingDownWithoutClosingBrowsers() { | 295 bool ShuttingDownWithoutClosingBrowsers() { |
293 #if defined(USE_X11) | 296 #if defined(USE_X11) |
294 if (GetShutdownType() == browser_shutdown::END_SESSION) | 297 if (GetShutdownType() == browser_shutdown::END_SESSION) |
295 return true; | 298 return true; |
296 #endif | 299 #endif |
297 return false; | 300 return false; |
298 } | 301 } |
299 | 302 |
300 } // namespace browser_shutdown | 303 } // namespace browser_shutdown |
OLD | NEW |