OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 bool BrowserProcessImpl::plugin_finder_disabled() const { | 675 bool BrowserProcessImpl::plugin_finder_disabled() const { |
676 return *plugin_finder_disabled_pref_; | 676 return *plugin_finder_disabled_pref_; |
677 } | 677 } |
678 | 678 |
679 void BrowserProcessImpl::Observe(int type, | 679 void BrowserProcessImpl::Observe(int type, |
680 const content::NotificationSource& source, | 680 const content::NotificationSource& source, |
681 const content::NotificationDetails& details) { | 681 const content::NotificationDetails& details) { |
682 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 682 if (type == chrome::NOTIFICATION_PREF_CHANGED) { |
683 std::string* pref = content::Details<std::string>(details).ptr(); | 683 std::string* pref = content::Details<std::string>(details).ptr(); |
684 if (*pref == prefs::kDefaultBrowserSettingEnabled) { | 684 if (*pref == prefs::kDefaultBrowserSettingEnabled) { |
685 if (local_state_->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) | 685 ApplyDefaultBrowserPolicy(); |
686 ShellIntegration::SetAsDefaultBrowser(); | |
687 } else if (*pref == prefs::kDisabledSchemes) { | 686 } else if (*pref == prefs::kDisabledSchemes) { |
688 ApplyDisabledSchemesPolicy(); | 687 ApplyDisabledSchemesPolicy(); |
689 } else if (*pref == prefs::kAllowCrossOriginAuthPrompt) { | 688 } else if (*pref == prefs::kAllowCrossOriginAuthPrompt) { |
690 ApplyAllowCrossOriginAuthPromptPolicy(); | 689 ApplyAllowCrossOriginAuthPromptPolicy(); |
691 } | 690 } |
692 } else { | 691 } else { |
693 NOTREACHED(); | 692 NOTREACHED(); |
694 } | 693 } |
695 } | 694 } |
696 | 695 |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 browser::RegisterLocalState(local_state_.get()); | 932 browser::RegisterLocalState(local_state_.get()); |
934 | 933 |
935 pref_change_registrar_.Init(local_state_.get()); | 934 pref_change_registrar_.Init(local_state_.get()); |
936 | 935 |
937 print_job_manager_->InitOnUIThread(local_state_.get()); | 936 print_job_manager_->InitOnUIThread(local_state_.get()); |
938 | 937 |
939 // Initialize the notification for the default browser setting policy. | 938 // Initialize the notification for the default browser setting policy. |
940 local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, | 939 local_state_->RegisterBooleanPref(prefs::kDefaultBrowserSettingEnabled, |
941 false); | 940 false); |
942 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled)) { | 941 if (local_state_->IsManagedPreference(prefs::kDefaultBrowserSettingEnabled)) { |
943 if (local_state_->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) | 942 ApplyDefaultBrowserPolicy(); |
944 ShellIntegration::SetAsDefaultBrowser(); | |
945 } | 943 } |
946 pref_change_registrar_.Add(prefs::kDefaultBrowserSettingEnabled, this); | 944 pref_change_registrar_.Add(prefs::kDefaultBrowserSettingEnabled, this); |
947 | 945 |
948 // Initialize the preference for the plugin finder policy. | 946 // Initialize the preference for the plugin finder policy. |
949 // This preference is only needed on the IO thread so make it available there. | 947 // This preference is only needed on the IO thread so make it available there. |
950 local_state_->RegisterBooleanPref(prefs::kDisablePluginFinder, false); | 948 local_state_->RegisterBooleanPref(prefs::kDisablePluginFinder, false); |
951 plugin_finder_disabled_pref_.Init(prefs::kDisablePluginFinder, | 949 plugin_finder_disabled_pref_.Init(prefs::kDisablePluginFinder, |
952 local_state_.get(), NULL); | 950 local_state_.get(), NULL); |
953 plugin_finder_disabled_pref_.MoveToThread(BrowserThread::IO); | 951 plugin_finder_disabled_pref_.MoveToThread(BrowserThread::IO); |
954 | 952 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1052 const ListValue* scheme_list = local_state_->GetList(prefs::kDisabledSchemes); | 1050 const ListValue* scheme_list = local_state_->GetList(prefs::kDisabledSchemes); |
1053 for (ListValue::const_iterator iter = scheme_list->begin(); | 1051 for (ListValue::const_iterator iter = scheme_list->begin(); |
1054 iter != scheme_list->end(); ++iter) { | 1052 iter != scheme_list->end(); ++iter) { |
1055 std::string scheme; | 1053 std::string scheme; |
1056 if ((*iter)->GetAsString(&scheme)) | 1054 if ((*iter)->GetAsString(&scheme)) |
1057 schemes.insert(scheme); | 1055 schemes.insert(scheme); |
1058 } | 1056 } |
1059 ChildProcessSecurityPolicy::GetInstance()->RegisterDisabledSchemes(schemes); | 1057 ChildProcessSecurityPolicy::GetInstance()->RegisterDisabledSchemes(schemes); |
1060 } | 1058 } |
1061 | 1059 |
| 1060 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { |
| 1061 if (local_state_->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { |
| 1062 scoped_refptr<ShellIntegration::DefaultWebClientWorker> |
| 1063 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); |
| 1064 set_browser_worker->StartSetAsDefault(); |
| 1065 } |
| 1066 } |
| 1067 |
1062 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { | 1068 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { |
1063 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); | 1069 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); |
1064 resource_dispatcher_host()->set_allow_cross_origin_auth_prompt(value); | 1070 resource_dispatcher_host()->set_allow_cross_origin_auth_prompt(value); |
1065 } | 1071 } |
1066 | 1072 |
1067 // The BrowserProcess object must outlive the file thread so we use traits | 1073 // The BrowserProcess object must outlive the file thread so we use traits |
1068 // which don't do any management. | 1074 // which don't do any management. |
1069 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl); | 1075 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl); |
1070 | 1076 |
1071 #if defined(IPC_MESSAGE_LOG_ENABLED) | 1077 #if defined(IPC_MESSAGE_LOG_ENABLED) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 } | 1162 } |
1157 | 1163 |
1158 void BrowserProcessImpl::OnAutoupdateTimer() { | 1164 void BrowserProcessImpl::OnAutoupdateTimer() { |
1159 if (CanAutorestartForUpdate()) { | 1165 if (CanAutorestartForUpdate()) { |
1160 DLOG(WARNING) << "Detected update. Restarting browser."; | 1166 DLOG(WARNING) << "Detected update. Restarting browser."; |
1161 RestartBackgroundInstance(); | 1167 RestartBackgroundInstance(); |
1162 } | 1168 } |
1163 } | 1169 } |
1164 | 1170 |
1165 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1171 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |