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/lifetime/application_lifetime.h" | 5 #include "chrome/browser/lifetime/application_lifetime.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 // request. | 169 // request. |
170 PrefService* pref_service = g_browser_process->local_state(); | 170 PrefService* pref_service = g_browser_process->local_state(); |
171 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false); | 171 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false); |
172 AttemptExitInternal(); | 172 AttemptExitInternal(); |
173 #endif | 173 #endif |
174 } | 174 } |
175 | 175 |
176 // The Android implementation is in application_lifetime_android.cc | 176 // The Android implementation is in application_lifetime_android.cc |
177 #if !defined(OS_ANDROID) | 177 #if !defined(OS_ANDROID) |
178 void AttemptRestart() { | 178 void AttemptRestart() { |
179 // Only accept one restart invocation. | |
180 static bool restart_already_requested = false; | |
sky
2013/06/17 14:55:27
Why do we need this? AttemptExit may not succeed.
scheib
2013/06/17 15:34:23
WillHandleBrowserAboutURL (browser_about_handler.c
| |
181 if (restart_already_requested) | |
182 return; | |
183 restart_already_requested = true; | |
184 | |
179 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead? | 185 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead? |
180 for (chrome::BrowserIterator it; !it.done(); it.Next()) | 186 for (chrome::BrowserIterator it; !it.done(); it.Next()) |
181 content::BrowserContext::SaveSessionState(it->profile()); | 187 content::BrowserContext::SaveSessionState(it->profile()); |
182 | 188 |
183 PrefService* pref_service = g_browser_process->local_state(); | 189 PrefService* pref_service = g_browser_process->local_state(); |
184 pref_service->SetBoolean(prefs::kWasRestarted, true); | 190 pref_service->SetBoolean(prefs::kWasRestarted, true); |
185 | 191 |
186 #if defined(OS_CHROMEOS) | 192 #if defined(OS_CHROMEOS) |
187 // For CrOS instead of browser restart (which is not supported) perform a full | 193 // For CrOS instead of browser restart (which is not supported) perform a full |
188 // sign out. Session will be only restored if user has that setting set. | 194 // sign out. Session will be only restored if user has that setting set. |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 // environment is still active. | 386 // environment is still active. |
381 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) | 387 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) |
382 return !ash::Shell::HasInstance(); | 388 return !ash::Shell::HasInstance(); |
383 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) | 389 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
384 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); | 390 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); |
385 #endif | 391 #endif |
386 return true; | 392 return true; |
387 } | 393 } |
388 | 394 |
389 } // namespace chrome | 395 } // namespace chrome |
OLD | NEW |