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_list.h" | 5 #include "chrome/browser/ui/browser_list.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 NotifyAndTerminate(true); | 229 NotifyAndTerminate(true); |
230 #else | 230 #else |
231 // Reset the restart bit that might have been set in cancelled restart | 231 // Reset the restart bit that might have been set in cancelled restart |
232 // request. | 232 // request. |
233 PrefService* pref_service = g_browser_process->local_state(); | 233 PrefService* pref_service = g_browser_process->local_state(); |
234 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false); | 234 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false); |
235 AttemptExitInternal(); | 235 AttemptExitInternal(); |
236 #endif | 236 #endif |
237 } | 237 } |
238 | 238 |
239 #if !defined(OS_ANDROID) | |
klobag.chromium
2012/12/20 02:22:31
Should we share the save session / pref?
gone
2012/12/21 19:19:00
An earlier version of this CL actually had that co
| |
239 void AttemptRestart() { | 240 void AttemptRestart() { |
240 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead? | 241 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead? |
241 BrowserList::const_iterator it; | 242 BrowserList::const_iterator it; |
242 for (it = BrowserList::begin(); it != BrowserList::end(); ++it) | 243 for (it = BrowserList::begin(); it != BrowserList::end(); ++it) |
243 content::BrowserContext::SaveSessionState((*it)->profile()); | 244 content::BrowserContext::SaveSessionState((*it)->profile()); |
244 | 245 |
245 PrefService* pref_service = g_browser_process->local_state(); | 246 PrefService* pref_service = g_browser_process->local_state(); |
246 pref_service->SetBoolean(prefs::kWasRestarted, true); | 247 pref_service->SetBoolean(prefs::kWasRestarted, true); |
247 | 248 |
248 #if defined(OS_CHROMEOS) | 249 #if defined(OS_CHROMEOS) |
249 // For CrOS instead of browser restart (which is not supported) perform a full | 250 // For CrOS instead of browser restart (which is not supported) perform a full |
250 // sign out. Session will be only restored if user has that setting set. | 251 // sign out. Session will be only restored if user has that setting set. |
251 // Same session restore behavior happens in case of full restart after update. | 252 // Same session restore behavior happens in case of full restart after update. |
252 AttemptUserExit(); | 253 AttemptUserExit(); |
253 #else | 254 #else |
254 // Set the flag to restore state after the restart. | 255 // Set the flag to restore state after the restart. |
255 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, true); | 256 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, true); |
256 AttemptExit(); | 257 AttemptExit(); |
257 #endif | 258 #endif |
258 } | 259 } |
260 #endif | |
259 | 261 |
260 #if defined(OS_WIN) | 262 #if defined(OS_WIN) |
261 void AttemptRestartWithModeSwitch() { | 263 void AttemptRestartWithModeSwitch() { |
262 // The kRestartSwitchMode preference does not exists for Windows 7 and older | 264 // The kRestartSwitchMode preference does not exists for Windows 7 and older |
263 // operating systems so there is no need for OS version check. | 265 // operating systems so there is no need for OS version check. |
264 PrefService* prefs = g_browser_process->local_state(); | 266 PrefService* prefs = g_browser_process->local_state(); |
265 prefs->SetBoolean(prefs::kRestartSwitchMode, true); | 267 prefs->SetBoolean(prefs::kRestartSwitchMode, true); |
266 browser::AttemptRestart(); | 268 browser::AttemptRestart(); |
267 } | 269 } |
268 #endif | 270 #endif |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
362 MessageLoop::current()) | 364 MessageLoop::current()) |
363 CloseAllBrowsers(); | 365 CloseAllBrowsers(); |
364 } | 366 } |
365 } | 367 } |
366 | 368 |
367 bool WillKeepAlive() { | 369 bool WillKeepAlive() { |
368 return g_keep_alive_count > 0; | 370 return g_keep_alive_count > 0; |
369 } | 371 } |
370 | 372 |
371 } // namespace browser | 373 } // namespace browser |
OLD | NEW |