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

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

Issue 6537020: Update policy backend and testserver for the newest policy protocol (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more last minute changes Created 9 years, 10 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_policy_identity_strategy.h
diff --git a/chrome/browser/policy/device_policy_identity_strategy.h b/chrome/browser/policy/device_policy_identity_strategy.h
index 838124d469ce9f00fd2caed7534914839bddc3d8..913a2a3e59660b7b2ff88e74c558ec7d8e1b7e70 100644
--- a/chrome/browser/policy/device_policy_identity_strategy.h
+++ b/chrome/browser/policy/device_policy_identity_strategy.h
@@ -8,6 +8,8 @@
#include <string>
+#include "base/ref_counted.h"
+#include "base/weak_ptr.h"
#include "chrome/browser/policy/cloud_policy_identity_strategy.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
@@ -21,20 +23,32 @@ class DevicePolicyIdentityStrategy : public CloudPolicyIdentityStrategy,
public NotificationObserver {
public:
DevicePolicyIdentityStrategy();
- virtual ~DevicePolicyIdentityStrategy() {}
+ virtual ~DevicePolicyIdentityStrategy();
+
+ // Called by DevicePolicyIdentityStrategy::OwnershipChecker:
+ virtual void OnOwnershipInformationAvailable(bool current_user_is_owner);
// CloudPolicyIdentityStrategy implementation:
virtual std::string GetDeviceToken();
virtual std::string GetDeviceID();
+ virtual std::string GetMachineID();
+ virtual em::DeviceRegisterRequest_Type GetPolicyRegisterType();
+ virtual std::string GetPolicyType();
virtual bool GetCredentials(std::string* username,
std::string* auth_token);
virtual void OnDeviceTokenAvailable(const std::string& token);
private:
+ class OwnershipChecker;
+
// Recheck whether all parameters are available and if so, trigger a
// credentials changed notification.
void CheckAndTriggerFetch();
+ // Updates the ownership information and then passes control to
+ // |CheckAndTriggerFetch|.
+ void CheckOwnershipAndTriggerFetch();
+
// NotificationObserver method overrides:
virtual void Observe(NotificationType type,
const NotificationSource& source,
@@ -43,17 +57,27 @@ class DevicePolicyIdentityStrategy : public CloudPolicyIdentityStrategy,
// The machine identifier.
std::string machine_id_;
+ // The device identifier to be sent with requests. (This is actually more like
+ // a session identifier since it is re-generated for each registration
+ // request.)
+ std::string device_id_;
+
// Current token. Empty if not available.
std::string device_token_;
- // Whether to try and register. Device policy enrollment does not happen
- // automatically except for the case that the device gets claimed. This
- // situation is detected by listening for the OWNERSHIP_TAKEN notification.
- bool should_register_;
+ // Whether the currently logged in user is the device's owner. This variable
+ // is owned by the UI thread but updated from the FILE thread. Therefore
+ // after an owner login it will take some time before it turns to true.
+ bool current_user_is_owner_;
// Registers the provider for notification of successful Gaia logins.
NotificationRegistrar registrar_;
+ scoped_refptr<OwnershipChecker> ownership_checker_;
+
+ // Allows to construct weak ptrs.
+ base::WeakPtrFactory<DevicePolicyIdentityStrategy> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(DevicePolicyIdentityStrategy);
};
« no previous file with comments | « chrome/browser/policy/device_management_backend_mock.h ('k') | chrome/browser/policy/device_policy_identity_strategy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698