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

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

Issue 49783006: policy: Remove SigninManager from UserCloudPolicyStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/cloud/user_cloud_policy_store.cc
diff --git a/chrome/browser/policy/cloud/user_cloud_policy_store.cc b/chrome/browser/policy/cloud/user_cloud_policy_store.cc
index cda8fb7f1c57b500da256413d8725a38faebb1a0..5b377d8962be61bb24f94176a0189a61315ee8cb 100644
--- a/chrome/browser/policy/cloud/user_cloud_policy_store.cc
+++ b/chrome/browser/policy/cloud/user_cloud_policy_store.cc
@@ -10,7 +10,6 @@
#include "base/task_runner_util.h"
#include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h"
#include "chrome/browser/policy/proto/cloud/device_management_local.pb.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/signin_manager.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "policy/policy_constants.h"
@@ -94,24 +93,26 @@ void StorePolicyToDiskOnBackgroundThread(
} // namespace
UserCloudPolicyStore::UserCloudPolicyStore(
- Profile* profile,
const base::FilePath& path,
scoped_refptr<base::SequencedTaskRunner> background_task_runner)
: UserCloudPolicyStoreBase(background_task_runner),
weak_factory_(this),
- profile_(profile),
backing_file_path_(path) {}
UserCloudPolicyStore::~UserCloudPolicyStore() {}
// static
scoped_ptr<UserCloudPolicyStore> UserCloudPolicyStore::Create(
- Profile* profile,
+ const base::FilePath& profile_path,
scoped_refptr<base::SequencedTaskRunner> background_task_runner) {
base::FilePath path =
- profile->GetPath().Append(kPolicyDir).Append(kPolicyCacheFile);
+ profile_path.Append(kPolicyDir).Append(kPolicyCacheFile);
return make_scoped_ptr(
- new UserCloudPolicyStore(profile, path, background_task_runner));
+ new UserCloudPolicyStore(path, background_task_runner));
+}
+
+void UserCloudPolicyStore::SetSigninUsername(const std::string& username) {
+ signin_username_ = username;
}
void UserCloudPolicyStore::LoadImmediately() {
@@ -217,17 +218,10 @@ void UserCloudPolicyStore::Validate(
scoped_ptr<UserCloudPolicyValidator> validator = CreateValidator(
policy.Pass(),
CloudPolicyValidatorBase::TIMESTAMP_NOT_BEFORE);
- SigninManager* signin = SigninManagerFactory::GetForProfileIfExists(profile_);
- if (signin) {
- std::string username = signin->GetAuthenticatedUsername();
- if (username.empty())
- username = signin->GetUsernameForAuthInProgress();
-
- // Validate the username if the user is signed in (or in the process of
- // signing in).
- if (!username.empty())
- validator->ValidateUsername(username);
- }
+
+ // Validate the username if the user is signed in.
+ if (!signin_username_.empty())
+ validator->ValidateUsername(signin_username_);
if (validate_in_background) {
// Start validation in the background. The Validator will free itself once
« no previous file with comments | « chrome/browser/policy/cloud/user_cloud_policy_store.h ('k') | chrome/browser/policy/cloud/user_cloud_policy_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698