OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_NOTIFICATION_ARC_PROVISION_NOTIFICATION_SERV
ICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_NOTIFICATION_ARC_PROVISION_NOTIFICATION_SERV
ICE_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "chrome/browser/chromeos/arc/arc_session_manager.h" |
| 12 #include "components/arc/arc_service.h" |
| 13 |
| 14 namespace arc { |
| 15 |
| 16 // Watches for ARC provisioning status and displays a notification during |
| 17 // provision when ARC OptIn happens silently due to enterprise policies. |
| 18 class ArcProvisionNotificationService : public ArcService, |
| 19 public ArcSessionManager::Observer { |
| 20 public: |
| 21 // The delegate whose methods are used by the service for showing/hiding the |
| 22 // notifications. The delegate exists primarily for unit testing purposes. |
| 23 class Delegate { |
| 24 public: |
| 25 Delegate(); |
| 26 virtual ~Delegate(); |
| 27 virtual void ShowManagedProvisionNotification() = 0; |
| 28 virtual void RemoveManagedProvisionNotification() = 0; |
| 29 |
| 30 private: |
| 31 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 32 }; |
| 33 |
| 34 // Constructs with the default delegate implementation that uses message |
| 35 // center for showing the notifications. |
| 36 explicit ArcProvisionNotificationService(ArcBridgeService* bridge_service); |
| 37 // Constructs with the supplied delegate. |
| 38 ArcProvisionNotificationService(ArcBridgeService* bridge_service, |
| 39 std::unique_ptr<Delegate> delegate); |
| 40 |
| 41 ~ArcProvisionNotificationService() override; |
| 42 |
| 43 protected: |
| 44 // ArcSessionManager::Observer: |
| 45 void OnArcPlayStoreEnabledChanged(bool enabled) override; |
| 46 void OnArcOptInManagementCheckStarted() override; |
| 47 void OnArcInitialStart() override; |
| 48 void OnArcSessionStopped(ArcStopReason stop_reason) override; |
| 49 void OnArcShowingErrorRequested(ArcSupportHost::Error error) override; |
| 50 |
| 51 private: |
| 52 std::unique_ptr<Delegate> delegate_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(ArcProvisionNotificationService); |
| 55 }; |
| 56 |
| 57 } // namespace arc |
| 58 |
| 59 #endif // CHROME_BROWSER_CHROMEOS_ARC_NOTIFICATION_ARC_PROVISION_NOTIFICATION_S
ERVICE_H_ |
OLD | NEW |