Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/policy/profile_policy_connector_factory.cc

Issue 24153012: Fix cyclic dependency between ProfilePolicyConnector and PrefService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix/Extend NetworkConfigurationUpdater unit test. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/policy/profile_policy_connector_factory.h" 5 #include "chrome/browser/policy/profile_policy_connector_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "chrome/browser/policy/profile_policy_connector.h" 9 #include "chrome/browser/policy/profile_policy_connector.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 CloudPolicyManager* user_cloud_policy_manager = 96 CloudPolicyManager* user_cloud_policy_manager =
97 UserCloudPolicyManagerFactoryChromeOS::GetForProfile(profile); 97 UserCloudPolicyManagerFactoryChromeOS::GetForProfile(profile);
98 #else 98 #else
99 CloudPolicyManager* user_cloud_policy_manager = 99 CloudPolicyManager* user_cloud_policy_manager =
100 UserCloudPolicyManagerFactory::GetForBrowserContext(profile); 100 UserCloudPolicyManagerFactory::GetForBrowserContext(profile);
101 #endif 101 #endif
102 #else 102 #else
103 CloudPolicyManager* user_cloud_policy_manager = NULL; 103 CloudPolicyManager* user_cloud_policy_manager = NULL;
104 #endif 104 #endif
105 ProfilePolicyConnector* connector = new ProfilePolicyConnector(profile); 105 ProfilePolicyConnector* connector = new ProfilePolicyConnector();
106 connector->Init(force_immediate_load, 106 connector->Init(force_immediate_load,
107 #if defined(ENABLE_CONFIGURATION_POLICY) && defined(OS_CHROMEOS) 107 #if defined(ENABLE_CONFIGURATION_POLICY) && defined(OS_CHROMEOS)
108 user, 108 user,
109 #endif 109 #endif
110 user_cloud_policy_manager); 110 user_cloud_policy_manager);
111 connectors_[profile] = connector; 111 connectors_[profile] = connector;
112 return make_scoped_ptr(connector); 112 return make_scoped_ptr(connector);
113 } 113 }
114 114
115 void ProfilePolicyConnectorFactory::BrowserContextShutdown( 115 void ProfilePolicyConnectorFactory::BrowserContextShutdown(
116 content::BrowserContext* context) { 116 content::BrowserContext* context) {
117 Profile* profile = static_cast<Profile*>(context); 117 Profile* profile = static_cast<Profile*>(context);
118 if (profile->IsOffTheRecord()) 118 if (profile->IsOffTheRecord())
119 return; 119 return;
120 ConnectorMap::iterator it = connectors_.find(profile); 120 ConnectorMap::iterator it = connectors_.find(profile);
121 if (it != connectors_.end()) 121 if (it != connectors_.end())
122 it->second->Shutdown(); 122 it->second->Shutdown();
123 } 123 }
124 124
125 void ProfilePolicyConnectorFactory::BrowserContextDestroyed( 125 void ProfilePolicyConnectorFactory::BrowserContextDestroyed(
126 content::BrowserContext* context) { 126 content::BrowserContext* context) {
127 ConnectorMap::iterator it = connectors_.find(static_cast<Profile*>(context)); 127 ConnectorMap::iterator it = connectors_.find(static_cast<Profile*>(context));
128 if (it != connectors_.end()) 128 if (it != connectors_.end())
129 connectors_.erase(it); 129 connectors_.erase(it);
130 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); 130 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context);
131 } 131 }
132 132
133 void ProfilePolicyConnectorFactory::RegisterProfilePrefs( 133 void ProfilePolicyConnectorFactory::RegisterProfilePrefs(
134 user_prefs::PrefRegistrySyncable* registry) { 134 user_prefs::PrefRegistrySyncable* registry) {
135 #if defined(OS_CHROMEOS)
136 registry->RegisterBooleanPref(
137 prefs::kUsedPolicyCertificatesOnce,
138 false,
139 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
140 #endif
141 #if defined(OS_ANDROID) 135 #if defined(OS_ANDROID)
142 registry->RegisterListPref( 136 registry->RegisterListPref(
143 prefs::kManagedBookmarks, 137 prefs::kManagedBookmarks,
144 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 138 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
145 #endif 139 #endif
146 } 140 }
147 141
148 void ProfilePolicyConnectorFactory::SetEmptyTestingFactory( 142 void ProfilePolicyConnectorFactory::SetEmptyTestingFactory(
149 content::BrowserContext* context) {} 143 content::BrowserContext* context) {}
150 144
151 void ProfilePolicyConnectorFactory::CreateServiceNow( 145 void ProfilePolicyConnectorFactory::CreateServiceNow(
152 content::BrowserContext* context) {} 146 content::BrowserContext* context) {}
153 147
154 } // namespace policy 148 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698