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

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

Issue 10409022: Move application lifetime functionality off BrowserList. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
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 <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/component_updater/component_updater_service.h" 27 #include "chrome/browser/component_updater/component_updater_service.h"
28 #include "chrome/browser/debugger/remote_debugging_server.h" 28 #include "chrome/browser/debugger/remote_debugging_server.h"
29 #include "chrome/browser/download/download_request_limiter.h" 29 #include "chrome/browser/download/download_request_limiter.h"
30 #include "chrome/browser/download/download_status_updater.h" 30 #include "chrome/browser/download/download_status_updater.h"
31 #include "chrome/browser/extensions/extension_event_router_forwarder.h" 31 #include "chrome/browser/extensions/extension_event_router_forwarder.h"
32 #include "chrome/browser/extensions/extension_tab_id_map.h" 32 #include "chrome/browser/extensions/extension_tab_id_map.h"
33 #include "chrome/browser/first_run/upgrade_util.h" 33 #include "chrome/browser/first_run/upgrade_util.h"
34 #include "chrome/browser/icon_manager.h" 34 #include "chrome/browser/icon_manager.h"
35 #include "chrome/browser/intranet_redirect_detector.h" 35 #include "chrome/browser/intranet_redirect_detector.h"
36 #include "chrome/browser/io_thread.h" 36 #include "chrome/browser/io_thread.h"
37 #include "chrome/browser/lifetime/application_lifetime.h"
37 #include "chrome/browser/metrics/metrics_service.h" 38 #include "chrome/browser/metrics/metrics_service.h"
38 #include "chrome/browser/metrics/thread_watcher.h" 39 #include "chrome/browser/metrics/thread_watcher.h"
39 #include "chrome/browser/metrics/variations_service.h" 40 #include "chrome/browser/metrics/variations_service.h"
40 #include "chrome/browser/net/chrome_net_log.h" 41 #include "chrome/browser/net/chrome_net_log.h"
41 #include "chrome/browser/net/crl_set_fetcher.h" 42 #include "chrome/browser/net/crl_set_fetcher.h"
42 #include "chrome/browser/net/sdch_dictionary_fetcher.h" 43 #include "chrome/browser/net/sdch_dictionary_fetcher.h"
43 #include "chrome/browser/notifications/notification_ui_manager.h" 44 #include "chrome/browser/notifications/notification_ui_manager.h"
44 #include "chrome/browser/policy/browser_policy_connector.h" 45 #include "chrome/browser/policy/browser_policy_connector.h"
45 #include "chrome/browser/policy/policy_service_impl.h" 46 #include "chrome/browser/policy/policy_service_impl.h"
46 #include "chrome/browser/policy/policy_service_stub.h" 47 #include "chrome/browser/policy/policy_service_stub.h"
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); 875 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt);
875 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); 876 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value);
876 } 877 }
877 878
878 // Mac is currently not supported. 879 // Mac is currently not supported.
879 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 880 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
880 881
881 bool BrowserProcessImpl::CanAutorestartForUpdate() const { 882 bool BrowserProcessImpl::CanAutorestartForUpdate() const {
882 // Check if browser is in the background and if it needs to be restarted to 883 // Check if browser is in the background and if it needs to be restarted to
883 // apply a pending update. 884 // apply a pending update.
884 return BrowserList::size() == 0 && BrowserList::WillKeepAlive() && 885 return BrowserList::size() == 0 && browser::WillKeepAlive() &&
885 upgrade_util::IsUpdatePendingRestart(); 886 upgrade_util::IsUpdatePendingRestart();
886 } 887 }
887 888
888 // Switches to add when auto-restarting Chrome. 889 // Switches to add when auto-restarting Chrome.
889 const char* const kSwitchesToAddOnAutorestart[] = { 890 const char* const kSwitchesToAddOnAutorestart[] = {
890 switches::kNoStartupWindow 891 switches::kNoStartupWindow
891 }; 892 };
892 893
893 void BrowserProcessImpl::RestartBackgroundInstance() { 894 void BrowserProcessImpl::RestartBackgroundInstance() {
894 CommandLine* old_cl = CommandLine::ForCurrentProcess(); 895 CommandLine* old_cl = CommandLine::ForCurrentProcess();
(...skipping 16 matching lines...) Expand all
911 } 912 }
912 } 913 }
913 914
914 // Ensure that our desired switches are set on the new process. 915 // Ensure that our desired switches are set on the new process.
915 for (size_t i = 0; i < arraysize(kSwitchesToAddOnAutorestart); ++i) { 916 for (size_t i = 0; i < arraysize(kSwitchesToAddOnAutorestart); ++i) {
916 if (!new_cl->HasSwitch(kSwitchesToAddOnAutorestart[i])) 917 if (!new_cl->HasSwitch(kSwitchesToAddOnAutorestart[i]))
917 new_cl->AppendSwitch(kSwitchesToAddOnAutorestart[i]); 918 new_cl->AppendSwitch(kSwitchesToAddOnAutorestart[i]);
918 } 919 }
919 920
920 DLOG(WARNING) << "Shutting down current instance of the browser."; 921 DLOG(WARNING) << "Shutting down current instance of the browser.";
921 BrowserList::AttemptExit(); 922 browser::AttemptExit();
922 923
923 // Transfer ownership to Upgrade. 924 // Transfer ownership to Upgrade.
924 upgrade_util::SetNewCommandLine(new_cl.release()); 925 upgrade_util::SetNewCommandLine(new_cl.release());
925 } 926 }
926 927
927 void BrowserProcessImpl::OnAutoupdateTimer() { 928 void BrowserProcessImpl::OnAutoupdateTimer() {
928 if (CanAutorestartForUpdate()) { 929 if (CanAutorestartForUpdate()) {
929 DLOG(WARNING) << "Detected update. Restarting browser."; 930 DLOG(WARNING) << "Detected update. Restarting browser.";
930 RestartBackgroundInstance(); 931 RestartBackgroundInstance();
931 } 932 }
932 } 933 }
933 934
934 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 935 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/background/background_mode_manager_unittest.cc ('k') | chrome/browser/browser_shutdown.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698