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

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

Issue 12212120: Replace most BrowserList::empty() and BrowserList::size() calls by multi-desktop aware calls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "chrome/browser/printing/background_printing_manager.h" 56 #include "chrome/browser/printing/background_printing_manager.h"
57 #include "chrome/browser/printing/print_job_manager.h" 57 #include "chrome/browser/printing/print_job_manager.h"
58 #include "chrome/browser/printing/print_preview_dialog_controller.h" 58 #include "chrome/browser/printing/print_preview_dialog_controller.h"
59 #include "chrome/browser/profiles/profile_manager.h" 59 #include "chrome/browser/profiles/profile_manager.h"
60 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" 60 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
61 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 61 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
62 #include "chrome/browser/shell_integration.h" 62 #include "chrome/browser/shell_integration.h"
63 #include "chrome/browser/status_icons/status_tray.h" 63 #include "chrome/browser/status_icons/status_tray.h"
64 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h" 64 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h"
65 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" 65 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h"
66 #include "chrome/browser/ui/browser_list.h" 66 #include "chrome/browser/ui/browser_finder.h"
67 #include "chrome/browser/web_resource/promo_resource_service.h" 67 #include "chrome/browser/web_resource/promo_resource_service.h"
68 #include "chrome/common/chrome_constants.h" 68 #include "chrome/common/chrome_constants.h"
69 #include "chrome/common/chrome_notification_types.h" 69 #include "chrome/common/chrome_notification_types.h"
70 #include "chrome/common/chrome_paths.h" 70 #include "chrome/common/chrome_paths.h"
71 #include "chrome/common/chrome_switches.h" 71 #include "chrome/common/chrome_switches.h"
72 #include "chrome/common/extensions/extension_l10n_util.h" 72 #include "chrome/common/extensions/extension_l10n_util.h"
73 #include "chrome/common/extensions/extension_resource.h" 73 #include "chrome/common/extensions/extension_resource.h"
74 #include "chrome/common/pref_names.h" 74 #include "chrome/common/pref_names.h"
75 #include "chrome/common/switch_utils.h" 75 #include "chrome/common/switch_utils.h"
76 #include "chrome/common/url_constants.h" 76 #include "chrome/common/url_constants.h"
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); 952 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt);
953 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); 953 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value);
954 } 954 }
955 955
956 // Mac is currently not supported. 956 // Mac is currently not supported.
957 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 957 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
958 958
959 bool BrowserProcessImpl::CanAutorestartForUpdate() const { 959 bool BrowserProcessImpl::CanAutorestartForUpdate() const {
960 // Check if browser is in the background and if it needs to be restarted to 960 // Check if browser is in the background and if it needs to be restarted to
961 // apply a pending update. 961 // apply a pending update.
962 return BrowserList::empty() && chrome::WillKeepAlive() && 962 return chrome::GetTotalBrowserCount() == 0 && chrome::WillKeepAlive() &&
963 upgrade_util::IsUpdatePendingRestart(); 963 upgrade_util::IsUpdatePendingRestart();
964 } 964 }
965 965
966 // Switches to add when auto-restarting Chrome. 966 // Switches to add when auto-restarting Chrome.
967 const char* const kSwitchesToAddOnAutorestart[] = { 967 const char* const kSwitchesToAddOnAutorestart[] = {
968 switches::kNoStartupWindow 968 switches::kNoStartupWindow
969 }; 969 };
970 970
971 void BrowserProcessImpl::RestartBackgroundInstance() { 971 void BrowserProcessImpl::RestartBackgroundInstance() {
972 CommandLine* old_cl = CommandLine::ForCurrentProcess(); 972 CommandLine* old_cl = CommandLine::ForCurrentProcess();
(...skipping 30 matching lines...) Expand all
1003 } 1003 }
1004 1004
1005 void BrowserProcessImpl::OnAutoupdateTimer() { 1005 void BrowserProcessImpl::OnAutoupdateTimer() {
1006 if (CanAutorestartForUpdate()) { 1006 if (CanAutorestartForUpdate()) {
1007 DLOG(WARNING) << "Detected update. Restarting browser."; 1007 DLOG(WARNING) << "Detected update. Restarting browser.";
1008 RestartBackgroundInstance(); 1008 RestartBackgroundInstance();
1009 } 1009 }
1010 } 1010 }
1011 1011
1012 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1012 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698