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..33d0fd9fbd1fe277d469d569363f0a3a8569a28b |
--- /dev/null |
+++ b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.h |
@@ -0,0 +1,51 @@ |
+// 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 OptIn happens silently due to enterprise 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: |
+ virtual ~Delegate() {} |
Luis Héctor Chávez
2017/03/13 15:50:41
nit: define in the .cc with = default.
emaxx
2017/03/16 18:32:12
Done.
|
+ virtual void ShowManagedProvisionNotification() = 0; |
+ virtual void RemoveManagedProvisionNotification() = 0; |
+ }; |
Luis Héctor Chávez
2017/03/13 15:50:41
nit: DISALLOW_COPY_AND_ASSIGN(Delegate);
emaxx
2017/03/16 18:32:12
Done.
But could you please explain what's the reas
Luis Héctor Chávez
2017/03/16 19:28:14
Just for consistency with the rest of the code.
|
+ |
+ explicit ArcProvisionNotificationService(ArcBridgeService* bridge_service); |
+ ArcProvisionNotificationService(ArcBridgeService* bridge_service, |
+ std::unique_ptr<Delegate> delegate); |
+ ~ArcProvisionNotificationService() override; |
+ |
+ protected: |
+ // ArcSessionManager::Observer: |
+ void OnArcPlayStoreEnabledChanged(bool enabled) override; |
+ void OnArcStartOptInAndroidManagementCheck() override; |
+ void OnArcInitialStart() override; |
+ void OnArcSessionStopped(ArcStopReason stop_reason) override; |
+ void OnArcSupportHostErrorShown(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_ |