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 opt-in flow happens silently due to configured 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 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 |
| 38 ~ArcProvisionNotificationService() override; |
| 39 |
| 40 // Constructs an instance with the supplied delegate. |
| 41 static std::unique_ptr<ArcProvisionNotificationService> CreateForTesting( |
| 42 ArcBridgeService* bridge_service, |
| 43 std::unique_ptr<Delegate> delegate); |
| 44 |
| 45 private: |
| 46 // Constructs with the supplied delegate. |
| 47 ArcProvisionNotificationService(ArcBridgeService* bridge_service, |
| 48 std::unique_ptr<Delegate> delegate); |
| 49 |
| 50 // ArcSessionManager::Observer: |
| 51 void OnArcPlayStoreEnabledChanged(bool enabled) override; |
| 52 void OnArcOptInManagementCheckStarted() override; |
| 53 void OnArcInitialStart() override; |
| 54 void OnArcSessionStopped(ArcStopReason stop_reason) override; |
| 55 void OnArcErrorShowRequested(ArcSupportHost::Error error) override; |
| 56 |
| 57 std::unique_ptr<Delegate> delegate_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(ArcProvisionNotificationService); |
| 60 }; |
| 61 |
| 62 } // namespace arc |
| 63 |
| 64 #endif // CHROME_BROWSER_CHROMEOS_ARC_NOTIFICATION_ARC_PROVISION_NOTIFICATION_S
ERVICE_H_ |
OLD | NEW |