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 |
683 | |
jam
2011/05/25 23:25:22
nit
| |
681 void BrowserProcessImpl::WaitForPluginDataRemoverToFinish() { | 684 void BrowserProcessImpl::WaitForPluginDataRemoverToFinish() { |
682 if (plugin_data_remover_.get()) | 685 if (plugin_data_remover_.get()) |
683 plugin_data_remover_->Wait(); | 686 plugin_data_remover_->Wait(); |
684 } | 687 } |
685 | 688 |
686 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 689 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
687 void BrowserProcessImpl::StartAutoupdateTimer() { | 690 void BrowserProcessImpl::StartAutoupdateTimer() { |
688 autoupdate_timer_.Start( | 691 autoupdate_timer_.Start( |
689 base::TimeDelta::FromHours(kUpdateCheckIntervalHours), | 692 base::TimeDelta::FromHours(kUpdateCheckIntervalHours), |
690 this, | 693 this, |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
937 | 940 |
938 // Initialize the disk cache location policy. This policy is not hot update- | 941 // Initialize the disk cache location policy. This policy is not hot update- |
939 // able so we need to have it when initializing the profiles. | 942 // able so we need to have it when initializing the profiles. |
940 local_state_->RegisterFilePathPref(prefs::kDiskCacheDir, FilePath()); | 943 local_state_->RegisterFilePathPref(prefs::kDiskCacheDir, FilePath()); |
941 | 944 |
942 // This is observed by ChildProcessSecurityPolicy, which lives in content/ | 945 // This is observed by ChildProcessSecurityPolicy, which lives in content/ |
943 // though, so it can't register itself. | 946 // though, so it can't register itself. |
944 local_state_->RegisterListPref(prefs::kDisabledSchemes); | 947 local_state_->RegisterListPref(prefs::kDisabledSchemes); |
945 pref_change_registrar_.Add(prefs::kDisabledSchemes, this); | 948 pref_change_registrar_.Add(prefs::kDisabledSchemes, this); |
946 ApplyDisabledSchemesPolicy(); | 949 ApplyDisabledSchemesPolicy(); |
950 | |
951 // This is needed under content/, so it can't register itself. | |
jam
2011/05/25 23:25:22
nit: this comment is a little off. content doesn'
| |
952 local_state_->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false); | |
953 pref_change_registrar_.Add(prefs::kAllowCrossOriginAuthPrompt, this); | |
954 ApplyAllowCrossOriginAuthPromptPolicy(); | |
947 } | 955 } |
948 | 956 |
949 void BrowserProcessImpl::CreateIconManager() { | 957 void BrowserProcessImpl::CreateIconManager() { |
950 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); | 958 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); |
951 created_icon_manager_ = true; | 959 created_icon_manager_ = true; |
952 icon_manager_.reset(new IconManager); | 960 icon_manager_.reset(new IconManager); |
953 } | 961 } |
954 | 962 |
955 void BrowserProcessImpl::CreateDevToolsManager() { | 963 void BrowserProcessImpl::CreateDevToolsManager() { |
956 DCHECK(devtools_manager_.get() == NULL); | 964 DCHECK(devtools_manager_.get() == NULL); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1044 const ListValue* scheme_list = local_state_->GetList(prefs::kDisabledSchemes); | 1052 const ListValue* scheme_list = local_state_->GetList(prefs::kDisabledSchemes); |
1045 for (ListValue::const_iterator iter = scheme_list->begin(); | 1053 for (ListValue::const_iterator iter = scheme_list->begin(); |
1046 iter != scheme_list->end(); ++iter) { | 1054 iter != scheme_list->end(); ++iter) { |
1047 std::string scheme; | 1055 std::string scheme; |
1048 if ((*iter)->GetAsString(&scheme)) | 1056 if ((*iter)->GetAsString(&scheme)) |
1049 schemes.insert(scheme); | 1057 schemes.insert(scheme); |
1050 } | 1058 } |
1051 ChildProcessSecurityPolicy::GetInstance()->RegisterDisabledSchemes(schemes); | 1059 ChildProcessSecurityPolicy::GetInstance()->RegisterDisabledSchemes(schemes); |
1052 } | 1060 } |
1053 | 1061 |
1062 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { | |
1063 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); | |
1064 ResourceDispatcherHost::set_allow_cross_origin_auth_prompt(value); | |
1065 } | |
1066 | |
1054 // The BrowserProcess object must outlive the file thread so we use traits | 1067 // The BrowserProcess object must outlive the file thread so we use traits |
1055 // which don't do any management. | 1068 // which don't do any management. |
1056 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl); | 1069 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl); |
1057 | 1070 |
1058 #if defined(IPC_MESSAGE_LOG_ENABLED) | 1071 #if defined(IPC_MESSAGE_LOG_ENABLED) |
1059 | 1072 |
1060 void BrowserProcessImpl::SetIPCLoggingEnabled(bool enable) { | 1073 void BrowserProcessImpl::SetIPCLoggingEnabled(bool enable) { |
1061 // First enable myself. | 1074 // First enable myself. |
1062 if (enable) | 1075 if (enable) |
1063 IPC::Logging::GetInstance()->Enable(); | 1076 IPC::Logging::GetInstance()->Enable(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1143 } | 1156 } |
1144 | 1157 |
1145 void BrowserProcessImpl::OnAutoupdateTimer() { | 1158 void BrowserProcessImpl::OnAutoupdateTimer() { |
1146 if (CanAutorestartForUpdate()) { | 1159 if (CanAutorestartForUpdate()) { |
1147 DLOG(WARNING) << "Detected update. Restarting browser."; | 1160 DLOG(WARNING) << "Detected update. Restarting browser."; |
1148 RestartPersistentInstance(); | 1161 RestartPersistentInstance(); |
1149 } | 1162 } |
1150 } | 1163 } |
1151 | 1164 |
1152 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1165 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
OLD | NEW |