Index: chrome/browser/chromeos/policy/consumer_management_notifier.h |
diff --git a/chrome/browser/chromeos/policy/consumer_management_notifier.h b/chrome/browser/chromeos/policy/consumer_management_notifier.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5569374f23bebaffffd29f9946324b4355c3b799 |
--- /dev/null |
+++ b/chrome/browser/chromeos/policy/consumer_management_notifier.h |
@@ -0,0 +1,55 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_MANAGEMENT_NOTIFIER_H_ |
+#define CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_MANAGEMENT_NOTIFIER_H_ |
+ |
+#include "base/macros.h" |
+#include "base/memory/weak_ptr.h" |
+#include "chrome/browser/chromeos/policy/consumer_management_service.h" |
+#include "components/keyed_service/core/keyed_service.h" |
+ |
+class Profile; |
+ |
+namespace policy { |
+ |
+// ConsumerManagementNotifier observes ConsumerManagementService and shows |
+// a desktop notification to the device owner if consumer enrollment or |
+// unenrollment suceeds or fails. |
+class ConsumerManagementNotifier |
+ : public KeyedService, |
+ public ConsumerManagementService::Observer { |
+ public: |
+ ConsumerManagementNotifier( |
+ Profile* profile, |
+ ConsumerManagementService* consumer_management_service); |
+ virtual ~ConsumerManagementNotifier(); |
bartfab (slow)
2014/11/27 14:09:09
Nit: Use |override| instead of |virtual|.
davidyu
2014/11/28 02:45:26
Done.
|
+ |
+ virtual void Shutdown() override; |
bartfab (slow)
2014/11/27 14:09:09
Nit: No |virtual| with |override|.
davidyu
2014/11/28 02:45:26
Done.
|
+ |
+ // ConsumerManagementService::Observer: |
+ virtual void OnConsumerManagementStatusChanged() override; |
bartfab (slow)
2014/11/27 14:09:09
Nit: No |virtual| with |override|.
davidyu
2014/11/28 02:45:26
Done.
|
+ |
+ private: |
+ // Shows a desktop notification. |
+ void ShowDesktopNotification( |
+ ConsumerManagementService::EnrollmentStage stage); |
+ |
+ // Opens the settings page. |
+ void OpenSettingsPage() const; |
+ |
+ // Opens the enrollment confirmation dialog in the settings page. |
+ void TryEnrollmentAgain() const; |
+ |
+ Profile* profile_; |
+ ConsumerManagementService* consumer_management_service_; |
+ |
+ base::WeakPtrFactory<ConsumerManagementNotifier> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ConsumerManagementNotifier); |
+}; |
+ |
+} // namespace policy |
+ |
+#endif // CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_MANAGEMENT_NOTIFIER_H_ |