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

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: it was a bad idea to zero out machine_id_ in the prev. patchset 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..e54832aedcbb7f90b68b745c3bf250aed39f2500 100644
--- a/chrome/browser/policy/device_policy_identity_strategy.h
+++ b/chrome/browser/policy/device_policy_identity_strategy.h
@@ -8,6 +8,7 @@
#include <string>
+#include "base/ref_counted.h"
#include "chrome/browser/policy/cloud_policy_identity_strategy.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
@@ -21,20 +22,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,6 +56,11 @@ 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_;
@@ -51,9 +69,16 @@ class DevicePolicyIdentityStrategy : public CloudPolicyIdentityStrategy,
// 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_;
+
DISALLOW_COPY_AND_ASSIGN(DevicePolicyIdentityStrategy);
};

Powered by Google App Engine
This is Rietveld 408576698