| 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_shutdown.h" | 5 #include "chrome/browser/browser_shutdown.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
| 16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
| 19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 20 #include "base/threading/thread_restrictions.h" | 20 #include "base/threading/thread_restrictions.h" |
| 21 #include "base/time.h" | 21 #include "base/time.h" |
| 22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 23 #include "chrome/browser/about_flags.h" | 23 #include "chrome/browser/about_flags.h" |
| 24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 25 #include "chrome/browser/first_run/upgrade_util.h" | 25 #include "chrome/browser/first_run/upgrade.h" |
| 26 #include "chrome/browser/jankometer.h" | 26 #include "chrome/browser/jankometer.h" |
| 27 #include "chrome/browser/metrics/metrics_service.h" | 27 #include "chrome/browser/metrics/metrics_service.h" |
| 28 #include "chrome/browser/prefs/pref_service.h" | 28 #include "chrome/browser/prefs/pref_service.h" |
| 29 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
| 30 #include "chrome/browser/service/service_process_control_manager.h" | 30 #include "chrome/browser/service/service_process_control_manager.h" |
| 31 #include "chrome/browser/ui/browser_list.h" | 31 #include "chrome/browser/ui/browser_list.h" |
| 32 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" | 32 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" |
| 33 #include "chrome/common/chrome_paths.h" | 33 #include "chrome/common/chrome_paths.h" |
| 34 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
| 35 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 true); | 182 true); |
| 183 #endif | 183 #endif |
| 184 | 184 |
| 185 // Uninstall Jank-O-Meter here after the IO thread is no longer running. | 185 // Uninstall Jank-O-Meter here after the IO thread is no longer running. |
| 186 UninstallJankometer(); | 186 UninstallJankometer(); |
| 187 | 187 |
| 188 if (delete_resources_on_shutdown) | 188 if (delete_resources_on_shutdown) |
| 189 ResourceBundle::CleanupSharedInstance(); | 189 ResourceBundle::CleanupSharedInstance(); |
| 190 | 190 |
| 191 #if defined(OS_WIN) | 191 #if defined(OS_WIN) |
| 192 if (!upgrade_util::IsBrowserAlreadyRunning() && | 192 if (!Upgrade::IsBrowserAlreadyRunning() && |
| 193 shutdown_type_ != browser_shutdown::END_SESSION) { | 193 shutdown_type_ != browser_shutdown::END_SESSION) { |
| 194 upgrade_util::SwapNewChromeExeIfPresent(); | 194 Upgrade::SwapNewChromeExeIfPresent(); |
| 195 } | 195 } |
| 196 #endif | 196 #endif |
| 197 | 197 |
| 198 if (restart_last_session) { | 198 if (restart_last_session) { |
| 199 #if !defined(OS_CHROMEOS) | 199 #if !defined(OS_CHROMEOS) |
| 200 // Make sure to relaunch the browser with the original command line plus | 200 // Make sure to relaunch the browser with the original command line plus |
| 201 // the Restore Last Session flag. Note that Chrome can be launched (ie. | 201 // the Restore Last Session flag. Note that Chrome can be launched (ie. |
| 202 // through ShellExecute on Windows) with a switch argument terminator at | 202 // through ShellExecute on Windows) with a switch argument terminator at |
| 203 // the end (double dash, as described in b/1366444) plus a URL, | 203 // the end (double dash, as described in b/1366444) plus a URL, |
| 204 // which prevents us from appending to the command line directly (issue | 204 // which prevents us from appending to the command line directly (issue |
| (...skipping 13 matching lines...) Expand all Loading... |
| 218 if (!switch_value.empty()) | 218 if (!switch_value.empty()) |
| 219 new_cl->AppendSwitchNative(i->first, i->second); | 219 new_cl->AppendSwitchNative(i->first, i->second); |
| 220 else | 220 else |
| 221 new_cl->AppendSwitch(i->first); | 221 new_cl->AppendSwitch(i->first); |
| 222 } | 222 } |
| 223 // Ensure restore last session is set. | 223 // Ensure restore last session is set. |
| 224 if (!new_cl->HasSwitch(switches::kRestoreLastSession)) | 224 if (!new_cl->HasSwitch(switches::kRestoreLastSession)) |
| 225 new_cl->AppendSwitch(switches::kRestoreLastSession); | 225 new_cl->AppendSwitch(switches::kRestoreLastSession); |
| 226 | 226 |
| 227 #if defined(OS_WIN) || defined(OS_LINUX) | 227 #if defined(OS_WIN) || defined(OS_LINUX) |
| 228 upgrade_util::RelaunchChromeBrowser(*new_cl.get()); | 228 Upgrade::RelaunchChromeBrowser(*new_cl.get()); |
| 229 #endif // defined(OS_WIN) || defined(OS_LINUX) | 229 #endif // defined(OS_WIN) || defined(OS_LINUX) |
| 230 | 230 |
| 231 #if defined(OS_MACOSX) | 231 #if defined(OS_MACOSX) |
| 232 new_cl->AppendSwitch(switches::kActivateOnLaunch); | 232 new_cl->AppendSwitch(switches::kActivateOnLaunch); |
| 233 base::LaunchApp(*new_cl.get(), false, false, NULL); | 233 base::LaunchApp(*new_cl.get(), false, false, NULL); |
| 234 #endif // defined(OS_MACOSX) | 234 #endif // defined(OS_MACOSX) |
| 235 | 235 |
| 236 #else | 236 #else |
| 237 NOTIMPLEMENTED(); | 237 NOTIMPLEMENTED(); |
| 238 #endif // !defined(OS_CHROMEOS) | 238 #endif // !defined(OS_CHROMEOS) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 bool ShuttingDownWithoutClosingBrowsers() { | 331 bool ShuttingDownWithoutClosingBrowsers() { |
| 332 #if defined(USE_X11) | 332 #if defined(USE_X11) |
| 333 if (GetShutdownType() == browser_shutdown::END_SESSION) | 333 if (GetShutdownType() == browser_shutdown::END_SESSION) |
| 334 return true; | 334 return true; |
| 335 #endif | 335 #endif |
| 336 return false; | 336 return false; |
| 337 } | 337 } |
| 338 | 338 |
| 339 } // namespace browser_shutdown | 339 } // namespace browser_shutdown |
| OLD | NEW |