| 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 <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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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) |
| OLD | NEW |