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

Unified Diff: chrome/browser/policy/device_token_fetcher.h

Issue 7298012: Consolidate data storage and notifications in the cloud policy subsystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 5 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/device_token_fetcher.h
diff --git a/chrome/browser/policy/device_token_fetcher.h b/chrome/browser/policy/device_token_fetcher.h
index c714cf32c9552a5e2512cf69975a657760f249dd..cec1b93145c85d953f26cd535fa9b4be3166d2d8 100644
--- a/chrome/browser/policy/device_token_fetcher.h
+++ b/chrome/browser/policy/device_token_fetcher.h
@@ -6,11 +6,7 @@
#define CHROME_BROWSER_POLICY_DEVICE_TOKEN_FETCHER_H_
#pragma once
-#include <string>
-
#include "base/memory/scoped_ptr.h"
-#include "base/observer_list.h"
-#include "base/task.h"
#include "chrome/browser/policy/delayed_work_scheduler.h"
#include "chrome/browser/policy/device_management_backend.h"
#include "chrome/browser/policy/policy_notifier.h"
@@ -19,6 +15,7 @@
namespace policy {
class CloudPolicyCacheBase;
+class CloudPolicyDataStore;
class DeviceManagementService;
namespace em = enterprise_management;
@@ -31,49 +28,34 @@ namespace em = enterprise_management;
class DeviceTokenFetcher
: public DeviceManagementBackend::DeviceRegisterResponseDelegate {
public:
- class Observer {
- public:
- virtual ~Observer() {}
- virtual void OnDeviceTokenAvailable() = 0;
- };
-
// |service| is used to talk to the device management service and |cache| is
// used to persist whether the device is unmanaged.
DeviceTokenFetcher(DeviceManagementService* service,
CloudPolicyCacheBase* cache,
+ CloudPolicyDataStore* data_store,
PolicyNotifier* notifier);
// Version for tests that allows to set timing parameters.
// Takes ownership of |scheduler|.
DeviceTokenFetcher(DeviceManagementService* service,
CloudPolicyCacheBase* cache,
+ CloudPolicyDataStore* data_store,
PolicyNotifier* notifier,
DelayedWorkScheduler* scheduler);
virtual ~DeviceTokenFetcher();
// Starts fetching a token.
// Declared virtual so it can be overridden by mocks.
- virtual void FetchToken(const std::string& auth_token,
- const std::string& device_id,
- em::DeviceRegisterRequest_Type policy_type,
- const std::string& machine_id,
- const std::string& machine_model);
+ virtual void FetchToken();
virtual void SetUnmanagedState();
- // Returns the device management token or the empty string if not available.
- // Declared virtual so it can be overridden by mocks.
- virtual const std::string& GetDeviceToken();
-
// Disables the auto-retry-on-error behavior of this token fetcher.
void StopAutoRetry();
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
-
// DeviceManagementBackend::DeviceRegisterResponseDelegate method overrides:
virtual void HandleRegisterResponse(
- const em::DeviceRegisterResponse& response);
- virtual void OnError(DeviceManagementBackend::ErrorCode code);
+ const em::DeviceRegisterResponse& response) OVERRIDE;
+ virtual void OnError(DeviceManagementBackend::ErrorCode code) OVERRIDE;
private:
friend class DeviceTokenFetcherTest;
@@ -103,6 +85,7 @@ class DeviceTokenFetcher
// Common initialization helper.
void Initialize(DeviceManagementService* service,
CloudPolicyCacheBase* cache,
+ CloudPolicyDataStore* data,
PolicyNotifier* notifier,
DelayedWorkScheduler* scheduler);
@@ -135,23 +118,9 @@ class DeviceTokenFetcher
// State the fetcher is currently in.
FetcherState state_;
- // Current device token.
- std::string device_token_;
-
- // Contains the AuthToken for the device management server.
- std::string auth_token_;
- // Device identifier to send to the server.
- std::string device_id_;
- // Contains policy type to send to the server.
- em::DeviceRegisterRequest_Type policy_type_;
- // Contains physical machine id to send to the server.
- std::string machine_id_;
- // Contains physical machine model to send to server.
- std::string machine_model_;
+ CloudPolicyDataStore* data_store_;
scoped_ptr<DelayedWorkScheduler> scheduler_;
-
- ObserverList<Observer, true> observer_list_;
};
} // namespace policy
« no previous file with comments | « chrome/browser/policy/device_policy_identity_strategy.cc ('k') | chrome/browser/policy/device_token_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698