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

Unified Diff: chrome/browser/chromeos/policy/consumer_management_notifier.h

Issue 733613005: Move the notification part out of ConsumerEnrollmentHandler so that it can be reused for unenrollme… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@enroll
Patch Set: Added a check for UserManager. 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: 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_

Powered by Google App Engine
This is Rietveld 408576698