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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 plugin_data_remover_->StartRemoving(base::Time()); | 665 plugin_data_remover_->StartRemoving(base::Time()); |
666 } | 666 } |
667 } | 667 } |
668 } else if (type == NotificationType::PREF_CHANGED) { | 668 } else if (type == NotificationType::PREF_CHANGED) { |
669 std::string* pref = Details<std::string>(details).ptr(); | 669 std::string* pref = Details<std::string>(details).ptr(); |
670 if (*pref == prefs::kDefaultBrowserSettingEnabled) { | 670 if (*pref == prefs::kDefaultBrowserSettingEnabled) { |
671 if (local_state_->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) | 671 if (local_state_->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) |
672 ShellIntegration::SetAsDefaultBrowser(); | 672 ShellIntegration::SetAsDefaultBrowser(); |
673 } else if (*pref == prefs::kDisabledSchemes) { | 673 } else if (*pref == prefs::kDisabledSchemes) { |
674 ApplyDisabledSchemesPolicy(); | 674 ApplyDisabledSchemesPolicy(); |
| 675 } else if (*pref == prefs::kAllowCrossOriginAuthPrompt) { |
| 676 ApplyAllowCrossOriginAuthPromptPolicy(); |
675 } | 677 } |
676 } else { | 678 } else { |
677 NOTREACHED(); | 679 NOTREACHED(); |
678 } | 680 } |
679 } | 681 } |
680 | 682 |
681 void BrowserProcessImpl::WaitForPluginDataRemoverToFinish() { | 683 void BrowserProcessImpl::WaitForPluginDataRemoverToFinish() { |
682 if (plugin_data_remover_.get()) | 684 if (plugin_data_remover_.get()) |
683 plugin_data_remover_->Wait(); | 685 plugin_data_remover_->Wait(); |
684 } | 686 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 resource_queue_delegates.insert(new UserScriptListener()); | 739 resource_queue_delegates.insert(new UserScriptListener()); |
738 | 740 |
739 resource_dispatcher_host_.reset( | 741 resource_dispatcher_host_.reset( |
740 new ResourceDispatcherHost(resource_queue_delegates)); | 742 new ResourceDispatcherHost(resource_queue_delegates)); |
741 resource_dispatcher_host_->Initialize(); | 743 resource_dispatcher_host_->Initialize(); |
742 | 744 |
743 resource_dispatcher_host_observer_.reset( | 745 resource_dispatcher_host_observer_.reset( |
744 new ChromeResourceDispatcherHostObserver(prerender_tracker())); | 746 new ChromeResourceDispatcherHostObserver(prerender_tracker())); |
745 resource_dispatcher_host_->set_observer( | 747 resource_dispatcher_host_->set_observer( |
746 resource_dispatcher_host_observer_.get()); | 748 resource_dispatcher_host_observer_.get()); |
| 749 |
| 750 pref_change_registrar_.Add(prefs::kAllowCrossOriginAuthPrompt, this); |
| 751 ApplyAllowCrossOriginAuthPromptPolicy(); |
747 } | 752 } |
748 | 753 |
749 void BrowserProcessImpl::CreateMetricsService() { | 754 void BrowserProcessImpl::CreateMetricsService() { |
750 DCHECK(!created_metrics_service_ && metrics_service_.get() == NULL); | 755 DCHECK(!created_metrics_service_ && metrics_service_.get() == NULL); |
751 created_metrics_service_ = true; | 756 created_metrics_service_ = true; |
752 | 757 |
753 metrics_service_.reset(new MetricsService); | 758 metrics_service_.reset(new MetricsService); |
754 } | 759 } |
755 | 760 |
756 void BrowserProcessImpl::CreateIOThread() { | 761 void BrowserProcessImpl::CreateIOThread() { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 const ListValue* scheme_list = local_state_->GetList(prefs::kDisabledSchemes); | 1049 const ListValue* scheme_list = local_state_->GetList(prefs::kDisabledSchemes); |
1045 for (ListValue::const_iterator iter = scheme_list->begin(); | 1050 for (ListValue::const_iterator iter = scheme_list->begin(); |
1046 iter != scheme_list->end(); ++iter) { | 1051 iter != scheme_list->end(); ++iter) { |
1047 std::string scheme; | 1052 std::string scheme; |
1048 if ((*iter)->GetAsString(&scheme)) | 1053 if ((*iter)->GetAsString(&scheme)) |
1049 schemes.insert(scheme); | 1054 schemes.insert(scheme); |
1050 } | 1055 } |
1051 ChildProcessSecurityPolicy::GetInstance()->RegisterDisabledSchemes(schemes); | 1056 ChildProcessSecurityPolicy::GetInstance()->RegisterDisabledSchemes(schemes); |
1052 } | 1057 } |
1053 | 1058 |
| 1059 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { |
| 1060 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); |
| 1061 resource_dispatcher_host()->set_allow_cross_origin_auth_prompt(value); |
| 1062 } |
| 1063 |
1054 // The BrowserProcess object must outlive the file thread so we use traits | 1064 // The BrowserProcess object must outlive the file thread so we use traits |
1055 // which don't do any management. | 1065 // which don't do any management. |
1056 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl); | 1066 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl); |
1057 | 1067 |
1058 #if defined(IPC_MESSAGE_LOG_ENABLED) | 1068 #if defined(IPC_MESSAGE_LOG_ENABLED) |
1059 | 1069 |
1060 void BrowserProcessImpl::SetIPCLoggingEnabled(bool enable) { | 1070 void BrowserProcessImpl::SetIPCLoggingEnabled(bool enable) { |
1061 // First enable myself. | 1071 // First enable myself. |
1062 if (enable) | 1072 if (enable) |
1063 IPC::Logging::GetInstance()->Enable(); | 1073 IPC::Logging::GetInstance()->Enable(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 } | 1153 } |
1144 | 1154 |
1145 void BrowserProcessImpl::OnAutoupdateTimer() { | 1155 void BrowserProcessImpl::OnAutoupdateTimer() { |
1146 if (CanAutorestartForUpdate()) { | 1156 if (CanAutorestartForUpdate()) { |
1147 DLOG(WARNING) << "Detected update. Restarting browser."; | 1157 DLOG(WARNING) << "Detected update. Restarting browser."; |
1148 RestartPersistentInstance(); | 1158 RestartPersistentInstance(); |
1149 } | 1159 } |
1150 } | 1160 } |
1151 | 1161 |
1152 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1162 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |