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/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.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/threading/thread_restrictions.h" | |
22 #include "base/time/time.h" | 21 #include "base/time/time.h" |
23 #include "build/build_config.h" | |
24 #include "chrome/browser/about_flags.h" | 22 #include "chrome/browser/about_flags.h" |
25 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
26 #include "chrome/browser/first_run/upgrade_util.h" | 24 #include "chrome/browser/first_run/upgrade_util.h" |
27 #include "chrome/browser/jankometer.h" | 25 #include "chrome/browser/jankometer.h" |
28 #include "chrome/browser/lifetime/application_lifetime.h" | 26 #include "chrome/browser/lifetime/application_lifetime.h" |
29 #include "chrome/browser/metrics/metrics_service.h" | 27 #include "chrome/browser/metrics/metrics_service.h" |
30 #include "chrome/browser/profiles/profile_manager.h" | 28 #include "chrome/browser/profiles/profile_manager.h" |
31 #include "chrome/browser/service_process/service_process_control.h" | 29 #include "chrome/browser/service_process/service_process_control.h" |
32 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
33 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/crash_keys.h" | 32 #include "chrome/common/crash_keys.h" |
35 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
36 #include "chrome/common/switch_utils.h" | 34 #include "chrome/common/switch_utils.h" |
37 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
38 #include "content/public/browser/render_process_host.h" | 36 #include "content/public/browser/render_process_host.h" |
39 #include "content/public/browser/render_view_host.h" | |
40 #include "ui/base/resource/resource_bundle.h" | |
41 | 37 |
42 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
43 #include "chrome/browser/browser_util_win.h" | 39 #include "chrome/browser/browser_util_win.h" |
44 #include "chrome/browser/first_run/upgrade_util_win.h" | 40 #include "chrome/browser/first_run/upgrade_util_win.h" |
45 #endif | 41 #endif |
46 | 42 |
47 #if defined(ENABLE_RLZ) | 43 #if defined(ENABLE_RLZ) |
48 #include "chrome/browser/rlz/rlz.h" | 44 #include "chrome/browser/rlz/rlz.h" |
49 #endif | 45 #endif |
50 | 46 |
51 #if defined(OS_CHROMEOS) | 47 #if defined(OS_CHROMEOS) |
52 #include "chrome/browser/chromeos/boot_times_loader.h" | 48 #include "chrome/browser/chromeos/boot_times_loader.h" |
53 #endif | 49 #endif |
54 | 50 |
55 using base::Time; | 51 using base::Time; |
56 using base::TimeDelta; | 52 using base::TimeDelta; |
57 using content::BrowserThread; | 53 using content::BrowserThread; |
58 | 54 |
59 namespace browser_shutdown { | 55 namespace browser_shutdown { |
60 namespace { | 56 namespace { |
61 | 57 |
62 // Whether the browser is trying to quit (e.g., Quit chosen from menu). | 58 // Whether the browser is trying to quit (e.g., Quit chosen from menu). |
63 bool g_trying_to_quit = false; | 59 bool g_trying_to_quit = false; |
64 | 60 |
65 // Whether the browser should quit without closing browsers. | |
66 bool g_shutting_down_without_closing_browsers = false; | |
67 | |
68 #if defined(OS_WIN) | 61 #if defined(OS_WIN) |
69 upgrade_util::RelaunchMode g_relaunch_mode = | 62 upgrade_util::RelaunchMode g_relaunch_mode = |
70 upgrade_util::RELAUNCH_MODE_DEFAULT; | 63 upgrade_util::RELAUNCH_MODE_DEFAULT; |
71 #endif | 64 #endif |
72 | 65 |
73 Time* shutdown_started_ = NULL; | 66 Time* shutdown_started_ = NULL; |
74 ShutdownType shutdown_type_ = NOT_VALID; | 67 ShutdownType shutdown_type_ = NOT_VALID; |
75 int shutdown_num_processes_; | 68 int shutdown_num_processes_; |
76 int shutdown_num_processes_slow_; | 69 int shutdown_num_processes_slow_; |
77 | 70 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 332 } |
340 | 333 |
341 void SetTryingToQuit(bool quitting) { | 334 void SetTryingToQuit(bool quitting) { |
342 g_trying_to_quit = quitting; | 335 g_trying_to_quit = quitting; |
343 } | 336 } |
344 | 337 |
345 bool IsTryingToQuit() { | 338 bool IsTryingToQuit() { |
346 return g_trying_to_quit; | 339 return g_trying_to_quit; |
347 } | 340 } |
348 | 341 |
349 bool ShuttingDownWithoutClosingBrowsers() { | |
350 return g_shutting_down_without_closing_browsers; | |
351 } | |
352 | |
353 void SetShuttingDownWithoutClosingBrowsers(bool without_close) { | |
354 g_shutting_down_without_closing_browsers = without_close; | |
355 } | |
356 | |
357 } // namespace browser_shutdown | 342 } // namespace browser_shutdown |
OLD | NEW |