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

Unified Diff: chrome/browser/policy/cloud/cloud_policy_client.h

Issue 12538009: Public Sessions: fetch device robot api token during enterprise enrollment. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 7 years, 8 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/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 b5b39b7b25d641fb31982111b04626b318c009cc..cd913e10fb6686a09552df727b20293fc5944969 100644
--- a/chrome/browser/policy/cloud/cloud_policy_client.h
+++ b/chrome/browser/policy/cloud/cloud_policy_client.h
@@ -53,6 +53,11 @@ 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. Only occurs during enrollment. Optional
+ // (default implementation is a noop).
+ virtual void OnRobotAuthCodesFetched(CloudPolicyClient* client);
+
// Indicates there's been an error in a previously-issued request.
virtual void OnClientError(CloudPolicyClient* client) = 0;
};
@@ -107,6 +112,11 @@ class CloudPolicyClient {
// requests and the latest request will eventually trigger notifications.
virtual void FetchPolicy();
+ // Requests OAuth2 auth codes 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 FetchRobotAuthCodes(const std::string& auth_token);
+
// Sends an unregistration request to the server.
virtual void Unregister();
@@ -171,6 +181,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;
@@ -188,6 +202,11 @@ class CloudPolicyClient {
DeviceManagementStatus status,
const enterprise_management::DeviceManagementResponse& response);
+ // Callback for robot account api authorization requests.
+ void OnFetchRobotAuthCodesCompleted(
+ DeviceManagementStatus status,
+ const enterprise_management::DeviceManagementResponse& response);
+
// Callback for unregistration requests.
void OnUnregisterCompleted(
DeviceManagementStatus status,
@@ -202,6 +221,7 @@ class CloudPolicyClient {
// Observer notification helpers.
void NotifyPolicyFetched();
void NotifyRegistrationStateChanged();
+ void NotifyRobotAuthCodesFetched();
void NotifyClientError();
// Data necessary for constructing policy requests.
@@ -217,6 +237,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_;

Powered by Google App Engine
This is Rietveld 408576698