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

Unified Diff: chrome/browser/chromeos/policy/consumer_management_notification.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: 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_notification.h
diff --git a/chrome/browser/chromeos/policy/consumer_management_notification.h b/chrome/browser/chromeos/policy/consumer_management_notification.h
new file mode 100644
index 0000000000000000000000000000000000000000..8137c11525c211126405245c138800b100dd00a0
--- /dev/null
+++ b/chrome/browser/chromeos/policy/consumer_management_notification.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_NOTIFICATION_H_
+#define CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_MANAGEMENT_NOTIFICATION_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 {
+
+// ConsumerManagementNotification observes ConsumerManagementService and shows
+// a desktop notification to the device owner if consumer enrollment or
+// unenrollment suceeds or fails.
+class ConsumerManagementNotification
Mattias Nissler (ping if slow) 2014/11/18 10:02:27 Naming is a bit unfortunate here. This class' life
davidyu 2014/11/19 02:54:21 Done.
+ : public KeyedService,
+ public ConsumerManagementService::Observer {
+ public:
+ ConsumerManagementNotification(
+ Profile* profile,
+ ConsumerManagementService* consumer_management_service);
+ virtual ~ConsumerManagementNotification();
+
+ virtual void Shutdown() override;
+
+ // ConsumerManagementService::Observer:
+ virtual void OnConsumerManagementStatusChanged() override;
+
+ 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<ConsumerManagementNotification> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ConsumerManagementNotification);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_MANAGEMENT_NOTIFICATION_H_

Powered by Google App Engine
This is Rietveld 408576698