OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 // apply a pending update. | 1114 // apply a pending update. |
1115 return BrowserList::size() == 0 && BrowserList::WillKeepAlive() && | 1115 return BrowserList::size() == 0 && BrowserList::WillKeepAlive() && |
1116 upgrade_util::IsUpdatePendingRestart(); | 1116 upgrade_util::IsUpdatePendingRestart(); |
1117 } | 1117 } |
1118 | 1118 |
1119 // Switches to add when auto-restarting Chrome. | 1119 // Switches to add when auto-restarting Chrome. |
1120 const char* const kSwitchesToAddOnAutorestart[] = { | 1120 const char* const kSwitchesToAddOnAutorestart[] = { |
1121 switches::kNoStartupWindow | 1121 switches::kNoStartupWindow |
1122 }; | 1122 }; |
1123 | 1123 |
1124 void BrowserProcessImpl::RestartPersistentInstance() { | 1124 void BrowserProcessImpl::RestartBackgroundInstance() { |
1125 CommandLine* old_cl = CommandLine::ForCurrentProcess(); | 1125 CommandLine* old_cl = CommandLine::ForCurrentProcess(); |
1126 scoped_ptr<CommandLine> new_cl(new CommandLine(old_cl->GetProgram())); | 1126 scoped_ptr<CommandLine> new_cl(new CommandLine(old_cl->GetProgram())); |
1127 | 1127 |
1128 std::map<std::string, CommandLine::StringType> switches = | 1128 std::map<std::string, CommandLine::StringType> switches = |
1129 old_cl->GetSwitches(); | 1129 old_cl->GetSwitches(); |
1130 | 1130 |
1131 switches::RemoveSwitchesForAutostart(&switches); | 1131 switches::RemoveSwitchesForAutostart(&switches); |
1132 | 1132 |
1133 // Append the rest of the switches (along with their values, if any) | 1133 // Append the rest of the switches (along with their values, if any) |
1134 // to the new command line | 1134 // to the new command line |
(...skipping 16 matching lines...) Expand all Loading... |
1151 DLOG(WARNING) << "Shutting down current instance of the browser."; | 1151 DLOG(WARNING) << "Shutting down current instance of the browser."; |
1152 BrowserList::AttemptExit(); | 1152 BrowserList::AttemptExit(); |
1153 | 1153 |
1154 // Transfer ownership to Upgrade. | 1154 // Transfer ownership to Upgrade. |
1155 upgrade_util::SetNewCommandLine(new_cl.release()); | 1155 upgrade_util::SetNewCommandLine(new_cl.release()); |
1156 } | 1156 } |
1157 | 1157 |
1158 void BrowserProcessImpl::OnAutoupdateTimer() { | 1158 void BrowserProcessImpl::OnAutoupdateTimer() { |
1159 if (CanAutorestartForUpdate()) { | 1159 if (CanAutorestartForUpdate()) { |
1160 DLOG(WARNING) << "Detected update. Restarting browser."; | 1160 DLOG(WARNING) << "Detected update. Restarting browser."; |
1161 RestartPersistentInstance(); | 1161 RestartBackgroundInstance(); |
1162 } | 1162 } |
1163 } | 1163 } |
1164 | 1164 |
1165 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1165 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |