Chromium Code Reviews| 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 | |
|
Mattias Nissler (ping if slow)
2011/05/26 09:55:51
excess whitespace
| |
| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 737 resource_queue_delegates.insert(new UserScriptListener()); | 740 resource_queue_delegates.insert(new UserScriptListener()); |
| 738 | 741 |
| 739 resource_dispatcher_host_.reset( | 742 resource_dispatcher_host_.reset( |
| 740 new ResourceDispatcherHost(resource_queue_delegates)); | 743 new ResourceDispatcherHost(resource_queue_delegates)); |
| 741 resource_dispatcher_host_->Initialize(); | 744 resource_dispatcher_host_->Initialize(); |
| 742 | 745 |
| 743 resource_dispatcher_host_observer_.reset( | 746 resource_dispatcher_host_observer_.reset( |
| 744 new ChromeResourceDispatcherHostObserver(prerender_tracker())); | 747 new ChromeResourceDispatcherHostObserver(prerender_tracker())); |
| 745 resource_dispatcher_host_->set_observer( | 748 resource_dispatcher_host_->set_observer( |
| 746 resource_dispatcher_host_observer_.get()); | 749 resource_dispatcher_host_observer_.get()); |
| 750 | |
| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 937 | 942 |
| 938 // Initialize the disk cache location policy. This policy is not hot update- | 943 // Initialize the disk cache location policy. This policy is not hot update- |
| 939 // able so we need to have it when initializing the profiles. | 944 // able so we need to have it when initializing the profiles. |
| 940 local_state_->RegisterFilePathPref(prefs::kDiskCacheDir, FilePath()); | 945 local_state_->RegisterFilePathPref(prefs::kDiskCacheDir, FilePath()); |
| 941 | 946 |
| 942 // This is observed by ChildProcessSecurityPolicy, which lives in content/ | 947 // This is observed by ChildProcessSecurityPolicy, which lives in content/ |
| 943 // though, so it can't register itself. | 948 // though, so it can't register itself. |
| 944 local_state_->RegisterListPref(prefs::kDisabledSchemes); | 949 local_state_->RegisterListPref(prefs::kDisabledSchemes); |
| 945 pref_change_registrar_.Add(prefs::kDisabledSchemes, this); | 950 pref_change_registrar_.Add(prefs::kDisabledSchemes, this); |
| 946 ApplyDisabledSchemesPolicy(); | 951 ApplyDisabledSchemesPolicy(); |
| 952 | |
| 953 // Chrome must tell code under content/ to change behavior, since content | |
| 954 // doesn't know about prefs. | |
| 955 local_state_->RegisterBooleanPref(prefs::kAllowCrossOriginAuthPrompt, false); | |
|
Mattias Nissler (ping if slow)
2011/05/26 09:55:51
Doing ad hoc pref registration is nowadays discour
| |
| 956 pref_change_registrar_.Add(prefs::kAllowCrossOriginAuthPrompt, this); | |
| 947 } | 957 } |
| 948 | 958 |
| 949 void BrowserProcessImpl::CreateIconManager() { | 959 void BrowserProcessImpl::CreateIconManager() { |
| 950 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); | 960 DCHECK(!created_icon_manager_ && icon_manager_.get() == NULL); |
| 951 created_icon_manager_ = true; | 961 created_icon_manager_ = true; |
| 952 icon_manager_.reset(new IconManager); | 962 icon_manager_.reset(new IconManager); |
| 953 } | 963 } |
| 954 | 964 |
| 955 void BrowserProcessImpl::CreateDevToolsManager() { | 965 void BrowserProcessImpl::CreateDevToolsManager() { |
| 956 DCHECK(devtools_manager_.get() == NULL); | 966 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); | 1054 const ListValue* scheme_list = local_state_->GetList(prefs::kDisabledSchemes); |
| 1045 for (ListValue::const_iterator iter = scheme_list->begin(); | 1055 for (ListValue::const_iterator iter = scheme_list->begin(); |
| 1046 iter != scheme_list->end(); ++iter) { | 1056 iter != scheme_list->end(); ++iter) { |
| 1047 std::string scheme; | 1057 std::string scheme; |
| 1048 if ((*iter)->GetAsString(&scheme)) | 1058 if ((*iter)->GetAsString(&scheme)) |
| 1049 schemes.insert(scheme); | 1059 schemes.insert(scheme); |
| 1050 } | 1060 } |
| 1051 ChildProcessSecurityPolicy::GetInstance()->RegisterDisabledSchemes(schemes); | 1061 ChildProcessSecurityPolicy::GetInstance()->RegisterDisabledSchemes(schemes); |
| 1052 } | 1062 } |
| 1053 | 1063 |
| 1064 void BrowserProcessImpl::ApplyAllowCrossOriginAuthPromptPolicy() { | |
| 1065 bool value = local_state()->GetBoolean(prefs::kAllowCrossOriginAuthPrompt); | |
| 1066 resource_dispatcher_host()->set_allow_cross_origin_auth_prompt(value); | |
| 1067 } | |
| 1068 | |
| 1054 // The BrowserProcess object must outlive the file thread so we use traits | 1069 // The BrowserProcess object must outlive the file thread so we use traits |
| 1055 // which don't do any management. | 1070 // which don't do any management. |
| 1056 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl); | 1071 DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowserProcessImpl); |
| 1057 | 1072 |
| 1058 #if defined(IPC_MESSAGE_LOG_ENABLED) | 1073 #if defined(IPC_MESSAGE_LOG_ENABLED) |
| 1059 | 1074 |
| 1060 void BrowserProcessImpl::SetIPCLoggingEnabled(bool enable) { | 1075 void BrowserProcessImpl::SetIPCLoggingEnabled(bool enable) { |
| 1061 // First enable myself. | 1076 // First enable myself. |
| 1062 if (enable) | 1077 if (enable) |
| 1063 IPC::Logging::GetInstance()->Enable(); | 1078 IPC::Logging::GetInstance()->Enable(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1143 } | 1158 } |
| 1144 | 1159 |
| 1145 void BrowserProcessImpl::OnAutoupdateTimer() { | 1160 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1146 if (CanAutorestartForUpdate()) { | 1161 if (CanAutorestartForUpdate()) { |
| 1147 DLOG(WARNING) << "Detected update. Restarting browser."; | 1162 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1148 RestartPersistentInstance(); | 1163 RestartPersistentInstance(); |
| 1149 } | 1164 } |
| 1150 } | 1165 } |
| 1151 | 1166 |
| 1152 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1167 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |