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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 #else | 235 #else |
236 // Reset the restart bit that might have been set in cancelled restart | 236 // Reset the restart bit that might have been set in cancelled restart |
237 // request. | 237 // request. |
238 PrefService* pref_service = g_browser_process->local_state(); | 238 PrefService* pref_service = g_browser_process->local_state(); |
239 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false); | 239 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false); |
240 AttemptExitInternal(); | 240 AttemptExitInternal(); |
241 #endif | 241 #endif |
242 } | 242 } |
243 | 243 |
244 void AttemptRestart() { | 244 void AttemptRestart() { |
245 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 245 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead? |
246 switches::kDisableRestoreSessionState)) { | 246 BrowserList::const_iterator it; |
247 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead? | 247 for (it = BrowserList::begin(); it != BrowserList::end(); ++it) |
248 BrowserList::const_iterator it; | 248 content::BrowserContext::SaveSessionState((*it)->profile()); |
249 for (it = BrowserList::begin(); it != BrowserList::end(); ++it) | |
250 content::BrowserContext::SaveSessionState((*it)->profile()); | |
251 } | |
252 | 249 |
253 PrefService* pref_service = g_browser_process->local_state(); | 250 PrefService* pref_service = g_browser_process->local_state(); |
254 pref_service->SetBoolean(prefs::kWasRestarted, true); | 251 pref_service->SetBoolean(prefs::kWasRestarted, true); |
255 | 252 |
256 #if defined(OS_CHROMEOS) | 253 #if defined(OS_CHROMEOS) |
257 // For CrOS instead of browser restart (which is not supported) perform a full | 254 // For CrOS instead of browser restart (which is not supported) perform a full |
258 // sign out. Session will be only restored if user has that setting set. | 255 // sign out. Session will be only restored if user has that setting set. |
259 // Same session restore behavior happens in case of full restart after update. | 256 // Same session restore behavior happens in case of full restart after update. |
260 AttemptUserExit(); | 257 AttemptUserExit(); |
261 #else | 258 #else |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 MessageLoop::current()) | 357 MessageLoop::current()) |
361 CloseAllBrowsers(); | 358 CloseAllBrowsers(); |
362 } | 359 } |
363 } | 360 } |
364 | 361 |
365 bool WillKeepAlive() { | 362 bool WillKeepAlive() { |
366 return g_keep_alive_count > 0; | 363 return g_keep_alive_count > 0; |
367 } | 364 } |
368 | 365 |
369 } // namespace browser | 366 } // namespace browser |
OLD | NEW |