Chromium Code Reviews| 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/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/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
| 15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "base/prefs/pref_registry_simple.h" | 16 #include "base/prefs/pref_registry_simple.h" |
| 17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 20 #include "base/threading/thread.h" | 20 #include "base/threading/thread.h" |
| 21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 22 #include "chrome/browser/about_flags.h" | 22 #include "chrome/browser/about_flags.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/first_run/upgrade_util.h" | |
| 25 #include "chrome/browser/lifetime/application_lifetime.h" | 24 #include "chrome/browser/lifetime/application_lifetime.h" |
| 26 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
| 27 #include "chrome/browser/profiles/profile_metrics.h" | 26 #include "chrome/browser/profiles/profile_metrics.h" |
| 28 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
| 29 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/crash_keys.h" | 29 #include "chrome/common/crash_keys.h" |
| 31 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 32 #include "chrome/common/switch_utils.h" | 31 #include "chrome/common/switch_utils.h" |
| 33 #include "components/metrics/metrics_service.h" | 32 #include "components/metrics/metrics_service.h" |
| 34 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
| 35 #include "content/public/browser/render_process_host.h" | 34 #include "content/public/browser/render_process_host.h" |
| 36 | 35 |
| 37 #if defined(OS_WIN) | 36 #if defined(OS_WIN) |
| 38 #include "chrome/browser/browser_util_win.h" | 37 #include "chrome/browser/browser_util_win.h" |
| 39 #include "chrome/browser/first_run/upgrade_util_win.h" | 38 #include "chrome/browser/first_run/upgrade_util_win.h" |
| 40 #endif | 39 #endif |
| 41 | 40 |
| 41 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | |
| 42 #include "chrome/browser/first_run/upgrade_util.h" | |
| 43 #endif | |
| 44 | |
| 42 #if defined(ENABLE_RLZ) | 45 #if defined(ENABLE_RLZ) |
| 43 #include "components/rlz/rlz_tracker.h" | 46 #include "components/rlz/rlz_tracker.h" |
| 44 #endif | 47 #endif |
| 45 | 48 |
| 46 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
| 47 #include "chrome/browser/chromeos/boot_times_recorder.h" | 50 #include "chrome/browser/chromeos/boot_times_recorder.h" |
| 48 #endif | 51 #endif |
| 49 | 52 |
| 50 #if defined(ENABLE_PRINT_PREVIEW) | 53 #if defined(ENABLE_PRINT_PREVIEW) |
| 51 #include "chrome/browser/service_process/service_process_control.h" | 54 #include "chrome/browser/service_process/service_process_control.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 for (const auto& it : switches) { | 242 for (const auto& it : switches) { |
| 240 const base::CommandLine::StringType& switch_value = it.second; | 243 const base::CommandLine::StringType& switch_value = it.second; |
| 241 if (!switch_value.empty()) | 244 if (!switch_value.empty()) |
| 242 new_cl->AppendSwitchNative(it.first, it.second); | 245 new_cl->AppendSwitchNative(it.first, it.second); |
| 243 else | 246 else |
| 244 new_cl->AppendSwitch(it.first); | 247 new_cl->AppendSwitch(it.first); |
| 245 } | 248 } |
| 246 | 249 |
| 247 #if defined(OS_WIN) | 250 #if defined(OS_WIN) |
| 248 upgrade_util::RelaunchChromeWithMode(*new_cl.get(), g_relaunch_mode); | 251 upgrade_util::RelaunchChromeWithMode(*new_cl.get(), g_relaunch_mode); |
| 249 #else | 252 #elif defined(OS_LINUX) |
|
gab
2015/09/30 14:39:43
Should this be OS_POSIX? Otherwise Mac isn't cover
Lei Zhang
2015/09/30 23:33:55
Good point. Thanks for catching that. I think this
| |
| 250 upgrade_util::RelaunchChromeBrowser(*new_cl.get()); | 253 upgrade_util::RelaunchChromeBrowser(*new_cl.get()); |
| 251 #endif // defined(OS_WIN) | 254 #endif // defined(OS_WIN) |
| 252 | 255 |
| 253 #else | 256 #else |
| 254 NOTIMPLEMENTED(); | 257 NOTIMPLEMENTED(); |
| 255 #endif // !defined(OS_CHROMEOS) | 258 #endif // !defined(OS_CHROMEOS) |
| 256 } | 259 } |
| 257 | 260 |
| 258 if (g_shutdown_type > NOT_VALID && g_shutdown_num_processes > 0) { | 261 if (g_shutdown_type > NOT_VALID && g_shutdown_num_processes > 0) { |
| 259 // Measure total shutdown time as late in the process as possible | 262 // Measure total shutdown time as late in the process as possible |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 | 337 |
| 335 void SetTryingToQuit(bool quitting) { | 338 void SetTryingToQuit(bool quitting) { |
| 336 g_trying_to_quit = quitting; | 339 g_trying_to_quit = quitting; |
| 337 } | 340 } |
| 338 | 341 |
| 339 bool IsTryingToQuit() { | 342 bool IsTryingToQuit() { |
| 340 return g_trying_to_quit; | 343 return g_trying_to_quit; |
| 341 } | 344 } |
| 342 | 345 |
| 343 } // namespace browser_shutdown | 346 } // namespace browser_shutdown |
| OLD | NEW |