Index: chrome/browser/policy/cloud/cloud_policy_client.h |
diff --git a/chrome/browser/policy/cloud/cloud_policy_client.h b/chrome/browser/policy/cloud/cloud_policy_client.h |
index d87fd842cf22c8ce04648dd118825155052a096f..c018279414b588ef1844806dec7438dbe3253d31 100644 |
--- a/chrome/browser/policy/cloud/cloud_policy_client.h |
+++ b/chrome/browser/policy/cloud/cloud_policy_client.h |
@@ -48,6 +48,10 @@ class CloudPolicyClient { |
// successful completion of registration and unregistration requests. |
virtual void OnRegistrationStateChanged(CloudPolicyClient* client) = 0; |
+ // Called when a request for device robot OAuth2 authorization tokens |
+ // returns successfully. |
+ virtual void OnRobotAuthCodesFetched(CloudPolicyClient* client) = 0; |
+ |
// Indicates there's been an error in a previously-issued request. |
virtual void OnClientError(CloudPolicyClient* client) = 0; |
}; |
@@ -102,6 +106,11 @@ class CloudPolicyClient { |
// requests and the latest request will eventually trigger notifications. |
virtual void FetchPolicy(); |
+ // Requests OAuth2 auth tokens for the device robot account. The client being |
+ // registered is a prerequisite to this operation and this call will CHECK if |
+ // the client is not in registered state. |
+ virtual void FetchRobotAuthTokens(const std::string& auth_token); |
+ |
// Sends an unregistration request to the server. |
virtual void Unregister(); |
@@ -159,6 +168,10 @@ class CloudPolicyClient { |
return status_; |
} |
+ const std::string& robot_api_auth_code() const { |
+ return robot_api_auth_code_; |
+ } |
+ |
protected: |
// A set of PolicyNamespaceKeys to fetch. |
typedef std::set<PolicyNamespaceKey> NamespaceSet; |
@@ -176,6 +189,11 @@ class CloudPolicyClient { |
DeviceManagementStatus status, |
const enterprise_management::DeviceManagementResponse& response); |
+ // Callback for robot account api authorization requests. |
+ void OnFetchRobotAuthTokensCompleted( |
+ DeviceManagementStatus status, |
+ const enterprise_management::DeviceManagementResponse& response); |
+ |
// Callback for unregistration requests. |
void OnUnregisterCompleted( |
DeviceManagementStatus status, |
@@ -184,6 +202,7 @@ class CloudPolicyClient { |
// Observer notification helpers. |
void NotifyPolicyFetched(); |
void NotifyRegistrationStateChanged(); |
+ void NotifyRobotAuthCodesFetched(); |
void NotifyClientError(); |
// Data necessary for constructing policy requests. |
@@ -199,6 +218,7 @@ class CloudPolicyClient { |
base::Time last_policy_timestamp_; |
int public_key_version_; |
bool public_key_version_valid_; |
+ std::string robot_api_auth_code_; |
// Used for issuing requests to the cloud. |
DeviceManagementService* service_; |