Index: chrome/browser/chromeos/policy/consumer_management_service.h |
diff --git a/chrome/browser/chromeos/policy/consumer_management_service.h b/chrome/browser/chromeos/policy/consumer_management_service.h |
index d4f1e2ba73cf473b727336daa3a1c21555a5208e..8cd5cccb0f9dade7985d1ac5cadc7af68eb5621d 100644 |
--- a/chrome/browser/chromeos/policy/consumer_management_service.h |
+++ b/chrome/browser/chromeos/policy/consumer_management_service.h |
@@ -12,6 +12,7 @@ |
#include "base/macros.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
+#include "base/observer_list.h" |
#include "base/strings/string16.h" |
#include "chrome/browser/notifications/notification_delegate.h" |
#include "chromeos/dbus/dbus_method_call_status.h" |
@@ -26,6 +27,7 @@ class ProfileOAuth2TokenService; |
namespace chromeos { |
class CryptohomeClient; |
+class DeviceSettingsService; |
} |
namespace content { |
@@ -75,6 +77,13 @@ class ConsumerManagementService : public content::NotificationObserver, |
ENROLLMENT_LAST, // This should always be the last one. |
}; |
+ class Observer { |
+ public: |
+ // Called when the enrollment state is changed. |
bartfab (slow)
2014/08/20 14:40:02
Nit: s/is changed/changes/
davidyu
2014/08/21 09:40:29
Done.
|
+ virtual void OnConsumerManagementEnrollmentStateChanged( |
+ ConsumerManagementService* service) = 0; |
bartfab (slow)
2014/08/20 14:40:02
Why not just pass the state here instead of the en
davidyu
2014/08/21 09:40:29
Done.
|
+ }; |
+ |
// GetOwner() invokes this with an argument set to the owner user ID, |
// or an empty string on failure. |
typedef base::Callback<void(const std::string&)> GetOwnerCallback; |
@@ -82,13 +91,18 @@ class ConsumerManagementService : public content::NotificationObserver, |
// SetOwner() invokes this with an argument indicating success or failure. |
typedef base::Callback<void(bool)> SetOwnerCallback; |
- explicit ConsumerManagementService(chromeos::CryptohomeClient* client); |
+ ConsumerManagementService( |
+ chromeos::CryptohomeClient* client, |
+ chromeos::DeviceSettingsService* device_settings_service); |
virtual ~ConsumerManagementService(); |
// Registers prefs. |
static void RegisterPrefs(PrefRegistrySimple* registry); |
+ void AddObserver(Observer* observer); |
+ void RemoveObserver(Observer* observer); |
+ |
// Returns the enrollment state. |
ConsumerEnrollmentState GetEnrollmentState() const; |
@@ -102,6 +116,15 @@ class ConsumerManagementService : public content::NotificationObserver, |
// |callback| is invoked with an agument indicating success or failure. |
void SetOwner(const std::string& user_id, const SetOwnerCallback& callback); |
+ // Returns true if the device is consumer managed. |
+ bool IsEnrolled() const; |
+ |
+ // Returns true if the enrollment is in progress. |
bartfab (slow)
2014/08/20 14:40:02
Nit: s/the/consumer/
davidyu
2014/08/21 09:40:29
Done.
|
+ bool IsEnrolling() const; |
+ |
+ // Returns true if the unenrollment is in progress. |
bartfab (slow)
2014/08/20 14:40:02
Nit: s/the/consumer/
davidyu
2014/08/21 09:40:29
Done.
|
+ bool IsUnenrolling() const; |
+ |
// content::NotificationObserver implmentation. |
virtual void Observe(int type, |
const content::NotificationSource& source, |
@@ -212,7 +235,10 @@ class ConsumerManagementService : public content::NotificationObserver, |
const base::string16& button_label, |
const base::Closure& button_click_callback) const; |
+ void NotifyEnrollmentStateChanged(); |
+ |
chromeos::CryptohomeClient* client_; |
+ chromeos::DeviceSettingsService* device_settings_service_; |
std::string enrolling_account_id_; |
Profile* enrolling_profile_; |
@@ -221,6 +247,7 @@ class ConsumerManagementService : public content::NotificationObserver, |
scoped_ptr<OAuth2TokenService::Request> token_request_; |
content::NotificationRegistrar registrar_; |
+ ObserverList<Observer, true> observers_; |
base::WeakPtrFactory<ConsumerManagementService> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(ConsumerManagementService); |