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_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "chrome/browser/devtools/devtools_auto_opener.h" | 39 #include "chrome/browser/devtools/devtools_auto_opener.h" |
40 #include "chrome/browser/devtools/remote_debugging_server.h" | 40 #include "chrome/browser/devtools/remote_debugging_server.h" |
41 #include "chrome/browser/download/download_request_limiter.h" | 41 #include "chrome/browser/download/download_request_limiter.h" |
42 #include "chrome/browser/download/download_status_updater.h" | 42 #include "chrome/browser/download/download_status_updater.h" |
43 #include "chrome/browser/gpu/gl_string_manager.h" | 43 #include "chrome/browser/gpu/gl_string_manager.h" |
44 #include "chrome/browser/gpu/gpu_mode_manager.h" | 44 #include "chrome/browser/gpu/gpu_mode_manager.h" |
45 #include "chrome/browser/icon_manager.h" | 45 #include "chrome/browser/icon_manager.h" |
46 #include "chrome/browser/intranet_redirect_detector.h" | 46 #include "chrome/browser/intranet_redirect_detector.h" |
47 #include "chrome/browser/io_thread.h" | 47 #include "chrome/browser/io_thread.h" |
48 #include "chrome/browser/lifetime/application_lifetime.h" | 48 #include "chrome/browser/lifetime/application_lifetime.h" |
| 49 #include "chrome/browser/lifetime/keep_alive_registry.h" |
49 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 50 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
50 #include "chrome/browser/metrics/chrome_metrics_services_manager_client.h" | 51 #include "chrome/browser/metrics/chrome_metrics_services_manager_client.h" |
51 #include "chrome/browser/metrics/thread_watcher.h" | 52 #include "chrome/browser/metrics/thread_watcher.h" |
52 #include "chrome/browser/net/chrome_net_log_helper.h" | 53 #include "chrome/browser/net/chrome_net_log_helper.h" |
53 #include "chrome/browser/net/crl_set_fetcher.h" | 54 #include "chrome/browser/net/crl_set_fetcher.h" |
54 #include "chrome/browser/notifications/notification_ui_manager.h" | 55 #include "chrome/browser/notifications/notification_ui_manager.h" |
55 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 56 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
56 #include "chrome/browser/plugins/plugin_finder.h" | 57 #include "chrome/browser/plugins/plugin_finder.h" |
57 #include "chrome/browser/prefs/browser_prefs.h" | 58 #include "chrome/browser/prefs/browser_prefs.h" |
58 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 59 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1244 cached_default_web_client_state_ = shell_integration::GetDefaultBrowser(); | 1245 cached_default_web_client_state_ = shell_integration::GetDefaultBrowser(); |
1245 #endif | 1246 #endif |
1246 } | 1247 } |
1247 | 1248 |
1248 // Mac is currently not supported. | 1249 // Mac is currently not supported. |
1249 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1250 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
1250 | 1251 |
1251 bool BrowserProcessImpl::CanAutorestartForUpdate() const { | 1252 bool BrowserProcessImpl::CanAutorestartForUpdate() const { |
1252 // Check if browser is in the background and if it needs to be restarted to | 1253 // Check if browser is in the background and if it needs to be restarted to |
1253 // apply a pending update. | 1254 // apply a pending update. |
1254 return chrome::GetTotalBrowserCount() == 0 && chrome::WillKeepAlive() && | 1255 return chrome::GetTotalBrowserCount() == 0 && |
| 1256 KeepAliveRegistry::GetInstance()->IsKeepingAlive() && |
1255 upgrade_util::IsUpdatePendingRestart(); | 1257 upgrade_util::IsUpdatePendingRestart(); |
1256 } | 1258 } |
1257 | 1259 |
1258 // Switches to add when auto-restarting Chrome. | 1260 // Switches to add when auto-restarting Chrome. |
1259 const char* const kSwitchesToAddOnAutorestart[] = { | 1261 const char* const kSwitchesToAddOnAutorestart[] = { |
1260 switches::kNoStartupWindow | 1262 switches::kNoStartupWindow |
1261 }; | 1263 }; |
1262 | 1264 |
1263 void BrowserProcessImpl::RestartBackgroundInstance() { | 1265 void BrowserProcessImpl::RestartBackgroundInstance() { |
1264 base::CommandLine* old_cl = base::CommandLine::ForCurrentProcess(); | 1266 base::CommandLine* old_cl = base::CommandLine::ForCurrentProcess(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 } | 1304 } |
1303 | 1305 |
1304 void BrowserProcessImpl::OnAutoupdateTimer() { | 1306 void BrowserProcessImpl::OnAutoupdateTimer() { |
1305 if (CanAutorestartForUpdate()) { | 1307 if (CanAutorestartForUpdate()) { |
1306 DLOG(WARNING) << "Detected update. Restarting browser."; | 1308 DLOG(WARNING) << "Detected update. Restarting browser."; |
1307 RestartBackgroundInstance(); | 1309 RestartBackgroundInstance(); |
1308 } | 1310 } |
1309 } | 1311 } |
1310 | 1312 |
1311 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1313 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |