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

Unified Diff: chrome/browser/policy/user_cloud_policy_manager.cc

Issue 10823212: Relanding this as this did not fix the chromiumos breakage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/policy/user_cloud_policy_manager.h ('k') | chrome/browser/policy/user_cloud_policy_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/user_cloud_policy_manager.cc
===================================================================
--- chrome/browser/policy/user_cloud_policy_manager.cc (revision 150399)
+++ chrome/browser/policy/user_cloud_policy_manager.cc (working copy)
@@ -56,32 +56,21 @@
store_->RemoveObserver(this);
}
-#if defined(OS_CHROMEOS)
// static
scoped_ptr<UserCloudPolicyManager> UserCloudPolicyManager::Create(
+ Profile* profile,
bool wait_for_policy_fetch) {
- FilePath profile_dir;
- CHECK(PathService::Get(chrome::DIR_USER_DATA, &profile_dir));
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- const FilePath policy_dir =
- profile_dir
- .Append(command_line->GetSwitchValuePath(switches::kLoginProfile))
- .Append(kPolicyDir);
- const FilePath policy_cache_file = policy_dir.Append(kPolicyCacheFile);
- const FilePath token_cache_file = policy_dir.Append(kTokenCacheFile);
-
- scoped_ptr<CloudPolicyStore> store(
- new UserCloudPolicyStoreChromeOS(
- chromeos::DBusThreadManager::Get()->GetSessionManagerClient(),
- token_cache_file, policy_cache_file));
+ scoped_ptr<CloudPolicyStore> store =
+ CloudPolicyStore::CreateUserPolicyStore(profile);
return scoped_ptr<UserCloudPolicyManager>(
new UserCloudPolicyManager(store.Pass(), wait_for_policy_fetch));
}
-#endif
void UserCloudPolicyManager::Initialize(PrefService* prefs,
DeviceManagementService* service,
UserAffiliation user_affiliation) {
+ DCHECK(service);
+ DCHECK(prefs);
DCHECK(!service_.get());
prefs_ = prefs;
scoped_ptr<CloudPolicyClient> client(
@@ -129,6 +118,18 @@
}
}
+bool UserCloudPolicyManager::IsClientRegistered() const {
+ if (!service_.get())
+ return false;
+ return service_->client()->is_registered();
+}
+
+void UserCloudPolicyManager::RegisterClient(const std::string& access_token) {
+ DCHECK(cloud_policy_service()) << "Callers must invoke Initialize() first";
+ if (!cloud_policy_service()->client()->is_registered())
+ cloud_policy_service()->client()->Register(access_token);
+}
+
bool UserCloudPolicyManager::IsInitializationComplete() const {
return store_->is_initialized() && !wait_for_policy_fetch_;
}
« no previous file with comments | « chrome/browser/policy/user_cloud_policy_manager.h ('k') | chrome/browser/policy/user_cloud_policy_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698