Commit 67a40e1c authored by Rohit Rao's avatar Rohit Rao Committed by Commit Bot

[ios] Calls BrowserPolicyConnectorIOS::Init() once threads are started.

BUG=1024115

Change-Id: I01f1a5f11710a6956cd17ada97b462c250c64d84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2079391
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarOwen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745265}
parent 35d42578
......@@ -132,6 +132,20 @@ void ApplicationContextImpl::PreCreateThreads() {
void ApplicationContextImpl::PreMainMessageLoopRun() {
DCHECK(thread_checker_.CalledOnValidThread());
// BrowserPolicyConnectorIOS is created very early because local_state()
// needs policy to be initialized with the managed preference values.
// However, policy fetches from the network and loading of disk caches
// requires that threads are running; this Init() call lets the connector
// resume its initialization now that the loops are spinning and the
// system request context is available for the fetchers.
BrowserPolicyConnectorIOS* browser_policy_connector =
GetBrowserPolicyConnector();
if (browser_policy_connector) {
DCHECK(IsEnterprisePolicyEnabled());
browser_policy_connector->Init(GetLocalState(),
GetSharedURLLoaderFactory());
}
}
void ApplicationContextImpl::StartTearDown() {
......
......@@ -48,7 +48,7 @@ ConfigurationPolicyProvider* BrowserPolicyConnectorIOS::GetPlatformProvider() {
void BrowserPolicyConnectorIOS::Init(
PrefService* local_state,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) {
InitInternal(local_state, nullptr);
InitInternal(local_state, /*device_management_service=*/nullptr);
}
bool BrowserPolicyConnectorIOS::IsEnterpriseManaged() const {
......
......@@ -48,6 +48,8 @@ source_set("browser_prefs") {
"//components/omnibox/browser",
"//components/password_manager/core/browser",
"//components/payments/core",
"//components/policy/core/browser",
"//components/policy/core/common",
"//components/pref_registry",
"//components/prefs",
"//components/proxy_config",
......
......@@ -28,6 +28,8 @@
#include "components/omnibox/browser/zero_suggest_provider.h"
#include "components/password_manager/core/browser/password_manager.h"
#include "components/payments/core/payment_prefs.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/policy_statistics_collector.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
......@@ -94,6 +96,8 @@ void RegisterLocalStatePrefs(PrefRegistrySimple* registry) {
IOSChromeMetricsServiceClient::RegisterPrefs(registry);
network_time::NetworkTimeTracker::RegisterPrefs(registry);
ios::NotificationPromo::RegisterPrefs(registry);
policy::BrowserPolicyConnector::RegisterPrefs(registry);
policy::PolicyStatisticsCollector::RegisterPrefs(registry);
PrefProxyConfigTrackerImpl::RegisterPrefs(registry);
rappor::RapporServiceImpl::RegisterPrefs(registry);
sessions::SessionIdGenerator::RegisterPrefs(registry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment