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

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

Issue 5153002: Use a service to create device management backends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. 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..dc7bc008bce65306e351c0418569cf3c540ee4ca 100644
--- a/chrome/browser/policy/device_management_policy_provider.cc
+++ b/chrome/browser/policy/device_management_policy_provider.cc
@@ -11,7 +11,6 @@
#include "base/time.h"
#include "chrome/browser/browser_thread.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"
#include "chrome/browser/policy/device_token_fetcher.h"
#include "chrome/common/chrome_paths.h"
@@ -19,16 +18,12 @@
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
-namespace {
+namespace policy {
-const char kChromePolicyScope[] = "cros/device";
+const char kChromePolicyScope[] = "chromeos/device";
const char kChromeDevicePolicySettingKey[] = "chrome-policy";
const int64 kPolicyRefreshRateInMinutes = 3 * 60; // 3 hours
-} // namespace
-
-namespace policy {
-
// Ensures that the portion of the policy provider implementation that requires
// the IOThread is deferred until the IOThread is fully initialized. The policy
// provider posts this task on the UI thread during its constructor, thereby
@@ -111,14 +106,6 @@ void DeviceManagementPolicyProvider::Shutdown() {
token_fetcher_->Shutdown();
}
-DeviceManagementBackend* DeviceManagementPolicyProvider::GetBackend() {
- if (!backend_.get()) {
- backend_.reset(new DeviceManagementBackendImpl(
- GetDeviceManagementURL()));
- }
- return backend_.get();
-}
-
void DeviceManagementPolicyProvider::Initialize() {
registrar_.Add(this,
NotificationType::DEVICE_TOKEN_AVAILABLE,
@@ -140,7 +127,7 @@ void DeviceManagementPolicyProvider::InitializeAfterIOThreadExists() {
FILE_PATH_LITERAL("Token"));
if (token_service_) {
token_fetcher_ =
- new DeviceTokenFetcher(GetBackend(), token_service_, token_path);
+ new DeviceTokenFetcher(backend_.get(), token_service_, token_path);
token_fetcher_->StartFetching();
}
}
@@ -152,9 +139,8 @@ void DeviceManagementPolicyProvider::SendPolicyRequest() {
em::DevicePolicySettingRequest* setting =
policy_request.add_setting_request();
setting->set_key(kChromeDevicePolicySettingKey);
- GetBackend()->ProcessPolicyRequest(token_fetcher_->GetDeviceToken(),
- policy_request,
- this);
+ backend_->ProcessPolicyRequest(token_fetcher_->GetDeviceToken(),
+ policy_request, this);
policy_request_pending_ = true;
}
}

Powered by Google App Engine
This is Rietveld 408576698