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

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: merge up to r182110 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
« no previous file with comments | « chrome/browser/browser_commands_unittest.cc ('k') | chrome/browser/chrome_main_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "chrome/browser/printing/background_printing_manager.h" 57 #include "chrome/browser/printing/background_printing_manager.h"
58 #include "chrome/browser/printing/print_job_manager.h" 58 #include "chrome/browser/printing/print_job_manager.h"
59 #include "chrome/browser/printing/print_preview_dialog_controller.h" 59 #include "chrome/browser/printing/print_preview_dialog_controller.h"
60 #include "chrome/browser/profiles/profile_manager.h" 60 #include "chrome/browser/profiles/profile_manager.h"
61 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" 61 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
62 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 62 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
63 #include "chrome/browser/shell_integration.h" 63 #include "chrome/browser/shell_integration.h"
64 #include "chrome/browser/status_icons/status_tray.h" 64 #include "chrome/browser/status_icons/status_tray.h"
65 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h" 65 #include "chrome/browser/thumbnails/render_widget_snapshot_taker.h"
66 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h" 66 #include "chrome/browser/ui/bookmarks/bookmark_prompt_controller.h"
67 #include "chrome/browser/ui/browser_list.h" 67 #include "chrome/browser/ui/browser_finder.h"
68 #include "chrome/browser/web_resource/promo_resource_service.h" 68 #include "chrome/browser/web_resource/promo_resource_service.h"
69 #include "chrome/common/chrome_constants.h" 69 #include "chrome/common/chrome_constants.h"
70 #include "chrome/common/chrome_notification_types.h" 70 #include "chrome/common/chrome_notification_types.h"
71 #include "chrome/common/chrome_paths.h" 71 #include "chrome/common/chrome_paths.h"
72 #include "chrome/common/chrome_switches.h" 72 #include "chrome/common/chrome_switches.h"
73 #include "chrome/common/extensions/extension_l10n_util.h" 73 #include "chrome/common/extensions/extension_l10n_util.h"
74 #include "chrome/common/extensions/extension_resource.h" 74 #include "chrome/common/extensions/extension_resource.h"
75 #include "chrome/common/pref_names.h" 75 #include "chrome/common/pref_names.h"
76 #include "chrome/common/switch_utils.h" 76 #include "chrome/common/switch_utils.h"
77 #include "chrome/common/url_constants.h" 77 #include "chrome/common/url_constants.h"
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); 980 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt);
981 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value); 981 ResourceDispatcherHost::Get()->SetAllowCrossOriginAuthPrompt(value);
982 } 982 }
983 983
984 // Mac is currently not supported. 984 // Mac is currently not supported.
985 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 985 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
986 986
987 bool BrowserProcessImpl::CanAutorestartForUpdate() const { 987 bool BrowserProcessImpl::CanAutorestartForUpdate() const {
988 // Check if browser is in the background and if it needs to be restarted to 988 // Check if browser is in the background and if it needs to be restarted to
989 // apply a pending update. 989 // apply a pending update.
990 return BrowserList::empty() && chrome::WillKeepAlive() && 990 return chrome::GetTotalBrowserCount() == 0 && chrome::WillKeepAlive() &&
991 upgrade_util::IsUpdatePendingRestart(); 991 upgrade_util::IsUpdatePendingRestart();
992 } 992 }
993 993
994 // Switches to add when auto-restarting Chrome. 994 // Switches to add when auto-restarting Chrome.
995 const char* const kSwitchesToAddOnAutorestart[] = { 995 const char* const kSwitchesToAddOnAutorestart[] = {
996 switches::kNoStartupWindow 996 switches::kNoStartupWindow
997 }; 997 };
998 998
999 void BrowserProcessImpl::RestartBackgroundInstance() { 999 void BrowserProcessImpl::RestartBackgroundInstance() {
1000 CommandLine* old_cl = CommandLine::ForCurrentProcess(); 1000 CommandLine* old_cl = CommandLine::ForCurrentProcess();
(...skipping 30 matching lines...) Expand all
1031 } 1031 }
1032 1032
1033 void BrowserProcessImpl::OnAutoupdateTimer() { 1033 void BrowserProcessImpl::OnAutoupdateTimer() {
1034 if (CanAutorestartForUpdate()) { 1034 if (CanAutorestartForUpdate()) {
1035 DLOG(WARNING) << "Detected update. Restarting browser."; 1035 DLOG(WARNING) << "Detected update. Restarting browser.";
1036 RestartBackgroundInstance(); 1036 RestartBackgroundInstance();
1037 } 1037 }
1038 } 1038 }
1039 1039
1040 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 1040 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/browser_commands_unittest.cc ('k') | chrome/browser/chrome_main_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698