Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 1376063005: Cleanup: Pull some browser keep alive functions into its own file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 24 matching lines...) Expand all
35 #include "chrome/browser/defaults.h" 35 #include "chrome/browser/defaults.h"
36 #include "chrome/browser/devtools/remote_debugging_server.h" 36 #include "chrome/browser/devtools/remote_debugging_server.h"
37 #include "chrome/browser/download/download_request_limiter.h" 37 #include "chrome/browser/download/download_request_limiter.h"
38 #include "chrome/browser/download/download_status_updater.h" 38 #include "chrome/browser/download/download_status_updater.h"
39 #include "chrome/browser/gpu/gl_string_manager.h" 39 #include "chrome/browser/gpu/gl_string_manager.h"
40 #include "chrome/browser/gpu/gpu_mode_manager.h" 40 #include "chrome/browser/gpu/gpu_mode_manager.h"
41 #include "chrome/browser/icon_manager.h" 41 #include "chrome/browser/icon_manager.h"
42 #include "chrome/browser/intranet_redirect_detector.h" 42 #include "chrome/browser/intranet_redirect_detector.h"
43 #include "chrome/browser/io_thread.h" 43 #include "chrome/browser/io_thread.h"
44 #include "chrome/browser/lifetime/application_lifetime.h" 44 #include "chrome/browser/lifetime/application_lifetime.h"
45 #include "chrome/browser/lifetime/browser_keep_alive.h"
45 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" 46 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
46 #include "chrome/browser/metrics/metrics_services_manager.h" 47 #include "chrome/browser/metrics/metrics_services_manager.h"
47 #include "chrome/browser/metrics/thread_watcher.h" 48 #include "chrome/browser/metrics/thread_watcher.h"
48 #include "chrome/browser/net/chrome_net_log_helper.h" 49 #include "chrome/browser/net/chrome_net_log_helper.h"
49 #include "chrome/browser/net/crl_set_fetcher.h" 50 #include "chrome/browser/net/crl_set_fetcher.h"
50 #include "chrome/browser/notifications/notification_ui_manager.h" 51 #include "chrome/browser/notifications/notification_ui_manager.h"
51 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" 52 #include "chrome/browser/plugins/chrome_plugin_service_filter.h"
52 #include "chrome/browser/plugins/plugin_finder.h" 53 #include "chrome/browser/plugins/plugin_finder.h"
53 #include "chrome/browser/prefs/browser_prefs.h" 54 #include "chrome/browser/prefs/browser_prefs.h"
54 #include "chrome/browser/prefs/chrome_pref_service_factory.h" 55 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 cached_default_web_client_state_ = ShellIntegration::GetDefaultBrowser(); 1227 cached_default_web_client_state_ = ShellIntegration::GetDefaultBrowser();
1227 #endif 1228 #endif
1228 } 1229 }
1229 1230
1230 // Mac is currently not supported. 1231 // Mac is currently not supported.
1231 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1232 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
1232 1233
1233 bool BrowserProcessImpl::CanAutorestartForUpdate() const { 1234 bool BrowserProcessImpl::CanAutorestartForUpdate() const {
1234 // Check if browser is in the background and if it needs to be restarted to 1235 // Check if browser is in the background and if it needs to be restarted to
1235 // apply a pending update. 1236 // apply a pending update.
1236 return chrome::GetTotalBrowserCount() == 0 && chrome::WillKeepAlive() && 1237 return chrome::GetTotalBrowserCount() == 0 &&
1238 browser_lifetime::WillKeepAlive() &&
1237 upgrade_util::IsUpdatePendingRestart(); 1239 upgrade_util::IsUpdatePendingRestart();
1238 } 1240 }
1239 1241
1240 // Switches to add when auto-restarting Chrome. 1242 // Switches to add when auto-restarting Chrome.
1241 const char* const kSwitchesToAddOnAutorestart[] = { 1243 const char* const kSwitchesToAddOnAutorestart[] = {
1242 switches::kNoStartupWindow 1244 switches::kNoStartupWindow
1243 }; 1245 };
1244 1246
1245 void BrowserProcessImpl::RestartBackgroundInstance() { 1247 void BrowserProcessImpl::RestartBackgroundInstance() {
1246 base::CommandLine* old_cl = base::CommandLine::ForCurrentProcess(); 1248 base::CommandLine* old_cl = base::CommandLine::ForCurrentProcess();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 } 1281 }
1280 1282
1281 void BrowserProcessImpl::OnAutoupdateTimer() { 1283 void BrowserProcessImpl::OnAutoupdateTimer() {
1282 if (CanAutorestartForUpdate()) { 1284 if (CanAutorestartForUpdate()) {
1283 DLOG(WARNING) << "Detected update. Restarting browser."; 1285 DLOG(WARNING) << "Detected update. Restarting browser.";
1284 RestartBackgroundInstance(); 1286 RestartBackgroundInstance();
1285 } 1287 }
1286 } 1288 }
1287 1289
1288 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1290 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698