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