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

Unified Diff: components/policy/core/common/cloud/cloud_policy_service.h

Issue 751703003: Implemented consumer management unenrollment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dcpm
Patch Set: Created 6 years, 1 month 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: components/policy/core/common/cloud/cloud_policy_service.h
diff --git a/components/policy/core/common/cloud/cloud_policy_service.h b/components/policy/core/common/cloud/cloud_policy_service.h
index efcbb3f6239d4f01ecc751eb1c284e75c4b6b856..80bb7a4022e2420f02f3bb75f28dd456f1c0d735 100644
--- a/components/policy/core/common/cloud/cloud_policy_service.h
+++ b/components/policy/core/common/cloud/cloud_policy_service.h
@@ -29,6 +29,10 @@ class POLICY_EXPORT CloudPolicyService : public CloudPolicyClient::Observer,
// bool parameter is true if the refresh was successful (no error).
typedef base::Callback<void(bool)> RefreshPolicyCallback;
+ // Callback invoked once the unregister attempt has completed. Passed bool
+ // parameter is true if unregistering was successful (no error).
+ typedef base::Callback<void(bool)> UnregisterCallback;
bartfab (slow) 2014/11/28 13:25:19 Nit: Use C++11 using = instead of typedef.
davidyu 2014/12/01 17:05:23 Done.
+
class POLICY_EXPORT Observer {
public:
// Invoked when CloudPolicyService has finished initializing (any initial
@@ -52,6 +56,11 @@ class POLICY_EXPORT CloudPolicyService : public CloudPolicyClient::Observer,
// or aborts because of errors.
void RefreshPolicy(const RefreshPolicyCallback& callback);
+ // Unregisters the device. |callback| will be invoked after the operation
+ // completes or aborts because of errors. All pending refresh policy requests
+ // will be aborted, and no further refresh policy requests will be allowed.
+ void Unregister(const UnregisterCallback& callback);
+
// Adds/Removes an Observer for this object.
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
@@ -76,6 +85,10 @@ class POLICY_EXPORT CloudPolicyService : public CloudPolicyClient::Observer,
// is passed through to the refresh callbacks.
void RefreshCompleted(bool success);
+ // Invokes the unregister callback and clears unregister state. The |success|
+ // flag is passed through to the unregister callback.
+ void UnregisterCompleted(bool success);
+
// The policy namespace fetched by |client_| and expected by |store_|.
PolicyNamespaceKey policy_ns_key_;
@@ -95,9 +108,17 @@ class POLICY_EXPORT CloudPolicyService : public CloudPolicyClient::Observer,
REFRESH_POLICY_STORE,
} refresh_state_;
+ // Tracks the state of a pending unregister operation, if any.
+ enum {
+ UNREGISTER_NONE,
+ UNREGISTER_PENDING,
+ } unregister_state_;
+
// Callbacks to invoke upon policy refresh.
std::vector<RefreshPolicyCallback> refresh_callbacks_;
+ UnregisterCallback unregister_callback_;
+
// Set to true once the service is initialized (initial policy load/refresh
// is complete).
bool initialization_complete_;

Powered by Google App Engine
This is Rietveld 408576698