| 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 "base/bind.h" | 7 #include "base/bind.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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 PrefService* pref_service = g_browser_process->local_state(); | 177 PrefService* pref_service = g_browser_process->local_state(); |
| 178 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false); | 178 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false); |
| 179 AttemptExitInternal(false); | 179 AttemptExitInternal(false); |
| 180 #endif | 180 #endif |
| 181 } | 181 } |
| 182 | 182 |
| 183 void StartShutdownTracing() { | 183 void StartShutdownTracing() { |
| 184 const base::CommandLine& command_line = | 184 const base::CommandLine& command_line = |
| 185 *base::CommandLine::ForCurrentProcess(); | 185 *base::CommandLine::ForCurrentProcess(); |
| 186 if (command_line.HasSwitch(switches::kTraceShutdown)) { | 186 if (command_line.HasSwitch(switches::kTraceShutdown)) { |
| 187 base::trace_event::CategoryFilter category_filter( | 187 base::trace_event::TraceConfig trace_config( |
| 188 command_line.GetSwitchValueASCII(switches::kTraceShutdown)); | 188 command_line.GetSwitchValueASCII(switches::kTraceShutdown), ""); |
| 189 base::trace_event::TraceLog::GetInstance()->SetEnabled( | 189 base::trace_event::TraceLog::GetInstance()->SetEnabled( |
| 190 category_filter, | 190 trace_config, |
| 191 base::trace_event::TraceLog::RECORDING_MODE, | 191 base::trace_event::TraceLog::RECORDING_MODE); |
| 192 base::trace_event::TraceOptions()); | |
| 193 } | 192 } |
| 194 TRACE_EVENT0("shutdown", "StartShutdownTracing"); | 193 TRACE_EVENT0("shutdown", "StartShutdownTracing"); |
| 195 } | 194 } |
| 196 | 195 |
| 197 // The Android implementation is in application_lifetime_android.cc | 196 // The Android implementation is in application_lifetime_android.cc |
| 198 #if !defined(OS_ANDROID) | 197 #if !defined(OS_ANDROID) |
| 199 void AttemptRestart() { | 198 void AttemptRestart() { |
| 200 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead? | 199 // TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead? |
| 201 for (chrome::BrowserIterator it; !it.done(); it.Next()) | 200 for (chrome::BrowserIterator it; !it.done(); it.Next()) |
| 202 content::BrowserContext::SaveSessionState(it->profile()); | 201 content::BrowserContext::SaveSessionState(it->profile()); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 return true; | 423 return true; |
| 425 } | 424 } |
| 426 | 425 |
| 427 void DisableShutdownForTesting(bool disable_shutdown_for_testing) { | 426 void DisableShutdownForTesting(bool disable_shutdown_for_testing) { |
| 428 g_disable_shutdown_for_testing = disable_shutdown_for_testing; | 427 g_disable_shutdown_for_testing = disable_shutdown_for_testing; |
| 429 if (!g_disable_shutdown_for_testing && !WillKeepAlive()) | 428 if (!g_disable_shutdown_for_testing && !WillKeepAlive()) |
| 430 CloseAllBrowsersIfNeeded(); | 429 CloseAllBrowsersIfNeeded(); |
| 431 } | 430 } |
| 432 | 431 |
| 433 } // namespace chrome | 432 } // namespace chrome |
| OLD | NEW |