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

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

Issue 4960003: Don't register gmail users at the device management server (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 10 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/device_management_policy_provider.cc
diff --git a/chrome/browser/policy/device_management_policy_provider.cc b/chrome/browser/policy/device_management_policy_provider.cc
index fbf36ce952650e50e923ec11880733bfbb4a6286..26407259fbe9a26317307902ae722a8c1cefcc80 100644
--- a/chrome/browser/policy/device_management_policy_provider.cc
+++ b/chrome/browser/policy/device_management_policy_provider.cc
@@ -10,6 +10,7 @@
#include "base/task.h"
#include "base/time.h"
#include "chrome/browser/browser_thread.h"
+#include "chrome/browser/profile.h"
#include "chrome/browser/policy/device_management_backend.h"
#include "chrome/browser/policy/device_management_backend_impl.h"
#include "chrome/browser/policy/device_management_policy_cache.h"
@@ -56,12 +57,25 @@ class DeviceManagementPolicyProvider::InitializeAfterIOThreadExistsTask
DeviceManagementPolicyProvider::DeviceManagementPolicyProvider(
const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list,
DeviceManagementBackend* backend,
- TokenService* token_service,
- const FilePath& storage_dir)
+ Profile* profile)
: ConfigurationPolicyProvider(policy_list),
backend_(backend),
- token_service_(token_service),
- storage_dir_(GetOrCreateDeviceManagementDir(storage_dir)),
+ profile_(profile),
+ storage_dir_(GetOrCreateDeviceManagementDir(profile_->GetPath())),
+ policy_request_pending_(false) {
+ Initialize();
+}
+
+DeviceManagementPolicyProvider::DeviceManagementPolicyProvider(
+ const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list,
+ DeviceManagementBackend* backend,
+ Profile* profile,
+ DeviceTokenFetcher* token_fetcher)
+ : ConfigurationPolicyProvider(policy_list),
+ backend_(backend),
+ profile_(profile),
+ token_fetcher_(token_fetcher),
+ storage_dir_(GetOrCreateDeviceManagementDir(profile_->GetPath())),
policy_request_pending_(false) {
Initialize();
}
@@ -106,7 +120,7 @@ void DeviceManagementPolicyProvider::OnError(
}
void DeviceManagementPolicyProvider::Shutdown() {
- token_service_ = NULL;
+ profile_ = NULL;
if (token_fetcher_)
token_fetcher_->Shutdown();
}
@@ -138,9 +152,11 @@ void DeviceManagementPolicyProvider::Initialize() {
void DeviceManagementPolicyProvider::InitializeAfterIOThreadExists() {
const FilePath token_path = storage_dir_.Append(
FILE_PATH_LITERAL("Token"));
- if (token_service_) {
- token_fetcher_ =
- new DeviceTokenFetcher(GetBackend(), token_service_, token_path);
+ if (profile_) {
+ if (!token_fetcher_) {
+ token_fetcher_ =
+ new DeviceTokenFetcher(GetBackend(), profile_, token_path);
+ }
token_fetcher_->StartFetching();
}
}

Powered by Google App Engine
This is Rietveld 408576698