Chromium Code Reviews| Index: chrome/browser/chromeos/arc/notification/arc_provision_notification_service.h |
| diff --git a/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.h b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4971e752bb7e242bce7d80a7ffe93a978eca842d |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright 2017 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_ARC_NOTIFICATION_ARC_PROVISION_NOTIFICATION_SERVICE_H_ |
| +#define CHROME_BROWSER_CHROMEOS_ARC_NOTIFICATION_ARC_PROVISION_NOTIFICATION_SERVICE_H_ |
| + |
| +#include <memory> |
| + |
| +#include "base/macros.h" |
| +#include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| +#include "components/arc/arc_service.h" |
| + |
| +namespace arc { |
| + |
| +// Watches for ARC provisioning status and displays a notification during |
| +// provision when ARC opt-in flow happens silently due to configured policies. |
| +class ArcProvisionNotificationService : public ArcService, |
| + public ArcSessionManager::Observer { |
| + public: |
| + // The delegate whose methods are used by the service for showing/hiding the |
| + // notifications. The delegate exists primarily for unit testing purposes. |
| + class Delegate { |
| + public: |
| + Delegate(); |
| + virtual ~Delegate(); |
| + virtual void ShowManagedProvisionNotification() = 0; |
| + virtual void RemoveManagedProvisionNotification() = 0; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(Delegate); |
| + }; |
| + |
| + // Constructs with the default delegate implementation that uses message |
| + // center for showing the notifications. |
| + explicit ArcProvisionNotificationService(ArcBridgeService* bridge_service); |
| + // Constructs with the supplied delegate. |
|
hidehiko
2017/04/12 04:51:34
nit: could you insert an empty line here?
emaxx
2017/04/12 13:06:46
Acknowledged.
|
| + ArcProvisionNotificationService(ArcBridgeService* bridge_service, |
|
Luis Héctor Chávez
2017/04/11 16:02:53
nit: Rather than having two constructors, how abou
hidehiko
2017/04/12 04:51:34
FYI: if creating default Delegate instance is not
emaxx
2017/04/12 13:06:46
Done.
emaxx
2017/04/12 13:06:46
Acknowledged.
|
| + std::unique_ptr<Delegate> delegate); |
| + |
| + ~ArcProvisionNotificationService() override; |
| + |
| + protected: |
| + // ArcSessionManager::Observer: |
| + void OnArcPlayStoreEnabledChanged(bool enabled) override; |
| + void OnArcOptInManagementCheckStarted() override; |
| + void OnArcInitialStart() override; |
| + void OnArcSessionStopped(ArcStopReason stop_reason) override; |
| + void OnArcErrorShowRequested(ArcSupportHost::Error error) override; |
| + |
| + private: |
| + std::unique_ptr<Delegate> delegate_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ArcProvisionNotificationService); |
| +}; |
| + |
| +} // namespace arc |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_ARC_NOTIFICATION_ARC_PROVISION_NOTIFICATION_SERVICE_H_ |