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

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: " 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..20fc4b702be6a09c0ae870d66dd5226d2f2f0724 100644
--- a/chrome/browser/policy/device_token_fetcher.h
+++ b/chrome/browser/policy/device_token_fetcher.h
@@ -11,6 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/task.h"
Joao da Silva 2011/07/06 16:45:14 Nit: observer_list.h and task.h not used
gfeher 2011/07/07 13:51:00 Done.
+#include "chrome/browser/policy/cloud_policy_data.h"
pastarmovj 2011/07/06 12:11:57 I think you might be able to only Fwd declare this
gfeher 2011/07/06 15:14:20 Done.
#include "chrome/browser/policy/delayed_work_scheduler.h"
#include "chrome/browser/policy/device_management_backend.h"
#include "chrome/browser/policy/policy_notifier.h"
@@ -31,45 +32,30 @@ 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,
+ CloudPolicyData* data,
PolicyNotifier* notifier);
// Version for tests that allows to set timing parameters.
// Takes ownership of |scheduler|.
DeviceTokenFetcher(DeviceManagementService* service,
CloudPolicyCacheBase* cache,
+ CloudPolicyData* data,
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);
@@ -103,6 +89,7 @@ class DeviceTokenFetcher
// Common initialization helper.
void Initialize(DeviceManagementService* service,
CloudPolicyCacheBase* cache,
+ CloudPolicyData* data,
PolicyNotifier* notifier,
DelayedWorkScheduler* scheduler);
@@ -135,23 +122,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_;
+ CloudPolicyData* data_;
scoped_ptr<DelayedWorkScheduler> scheduler_;
-
- ObserverList<Observer, true> observer_list_;
};
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698