Chromium Code Reviews| 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_ |