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

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

Issue 10823208: Reverting this as it causes browser tests on the Linux ChromiumOS builder to fail. (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
Index: chrome/browser/policy/user_cloud_policy_store.cc
===================================================================
--- chrome/browser/policy/user_cloud_policy_store.cc (revision 150390)
+++ chrome/browser/policy/user_cloud_policy_store.cc (working copy)
@@ -1,79 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/policy/user_cloud_policy_store.h"
-
-#include "base/bind.h"
-#include "chrome/browser/policy/proto/cloud_policy.pb.h"
-#include "chrome/browser/signin/signin_manager.h"
-#include "chrome/browser/signin/signin_manager_factory.h"
-
-using enterprise_management::PolicyData;
-
-namespace policy {
-
-UserCloudPolicyStore::UserCloudPolicyStore(Profile* profile)
- : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
- profile_(profile) {
-}
-
-UserCloudPolicyStore::~UserCloudPolicyStore() {
-}
-
-void UserCloudPolicyStore::Load() {
- // TODO(atwilson): Read policy from file.
- policy_.reset();
- policy_map_.Clear();
- NotifyStoreLoaded();
-}
-
-void UserCloudPolicyStore::Store(
- const enterprise_management::PolicyFetchResponse& policy) {
- // Stop any pending requests to store policy, then validate the new policy
- // before storing it.
- weak_factory_.InvalidateWeakPtrs();
- scoped_ptr<enterprise_management::PolicyFetchResponse> policy_copy(
- new enterprise_management::PolicyFetchResponse(policy));
- Validate(policy_copy.Pass(),
- base::Bind(&UserCloudPolicyStore::StorePolicyAfterValidation,
- weak_factory_.GetWeakPtr()));
-}
-
-void UserCloudPolicyStore::Validate(
- scoped_ptr<enterprise_management::PolicyFetchResponse> policy,
- const UserCloudPolicyValidator::CompletionCallback& callback) {
- // Configure the validator.
- scoped_ptr<UserCloudPolicyValidator> validator =
- CreateValidator(policy.Pass(), callback);
- SigninManager* signin = SigninManagerFactory::GetForProfile(profile_);
- std::string username = signin->GetAuthenticatedUsername();
- DCHECK(!username.empty());
- validator->ValidateUsername(username);
-
- // Start validation. The Validator will free itself once validation is
- // complete.
- validator.release()->StartValidation();
-}
-
-void UserCloudPolicyStore::StorePolicyAfterValidation(
- UserCloudPolicyValidator* validator) {
- validation_status_ = validator->status();
- if (!validator->success()) {
- status_ = STATUS_VALIDATION_ERROR;
- NotifyStoreError();
- return;
- }
- // TODO(atwilson): Write policy to file.
- InstallPolicy(validator->policy_data().Pass(), validator->payload().Pass());
- status_ = STATUS_OK;
- NotifyStoreLoaded();
-}
-
-// static
-scoped_ptr<CloudPolicyStore> CloudPolicyStore::CreateUserPolicyStore(
- Profile* profile) {
- return scoped_ptr<CloudPolicyStore>(new UserCloudPolicyStore(profile));
-}
-
-} // namespace policy
« no previous file with comments | « chrome/browser/policy/user_cloud_policy_store.h ('k') | chrome/browser/policy/user_cloud_policy_store_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698