Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h

Issue 2649103006: arc: Add splash screen for ARC++ Kiosk startup (Closed)
Patch Set: use base::Bind for timer start Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_SERVICE_H_ 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_SERVICE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.h" 9 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.h"
10 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.h" 10 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.h"
(...skipping 15 matching lines...) Expand all
26 // Keeps track of ARC session state and auto-launches kiosk app when it's ready. 26 // Keeps track of ARC session state and auto-launches kiosk app when it's ready.
27 // App is started when the following conditions are satisfied: 27 // App is started when the following conditions are satisfied:
28 // 1. App id is registered in ArcAppListPrefs and set to "ready" state. 28 // 1. App id is registered in ArcAppListPrefs and set to "ready" state.
29 // 2. Got empty policy compliance report from Android 29 // 2. Got empty policy compliance report from Android
30 // 3. App is not yet started 30 // 3. App is not yet started
31 // Also, the app is stopped when one of above conditions changes. 31 // Also, the app is stopped when one of above conditions changes.
32 class ArcKioskAppService 32 class ArcKioskAppService
33 : public KeyedService, 33 : public KeyedService,
34 public ArcAppListPrefs::Observer, 34 public ArcAppListPrefs::Observer,
35 public ArcKioskAppManager::ArcKioskAppManagerObserver, 35 public ArcKioskAppManager::ArcKioskAppManagerObserver,
36 public arc::ArcKioskBridge::Delegate { 36 public arc::ArcKioskBridge::Delegate,
37 public ArcKioskAppLauncher::Delegate {
37 public: 38 public:
39 class Delegate {
40 public:
41 virtual void OnAppStarted() = 0;
42 virtual void OnAppWindowLaunched() = 0;
43
44 protected:
45 virtual ~Delegate() = default;
46 };
achuithb 2017/02/03 00:35:00 DISALLOW_COPY_AND_ASSIGN
Sergey Poromov 2017/02/03 15:15:36 Done.
47
38 static ArcKioskAppService* Create(Profile* profile); 48 static ArcKioskAppService* Create(Profile* profile);
39 static ArcKioskAppService* Get(content::BrowserContext* context); 49 static ArcKioskAppService* Get(content::BrowserContext* context);
40 50
51 void SetDelegate(Delegate* delegate);
52
41 // KeyedService overrides 53 // KeyedService overrides
42 void Shutdown() override; 54 void Shutdown() override;
43 55
44 // ArcAppListPrefs::Observer overrides 56 // ArcAppListPrefs::Observer overrides
45 void OnAppRegistered(const std::string& app_id, 57 void OnAppRegistered(const std::string& app_id,
46 const ArcAppListPrefs::AppInfo& app_info) override; 58 const ArcAppListPrefs::AppInfo& app_info) override;
47 void OnAppReadyChanged(const std::string& id, bool ready) override; 59 void OnAppReadyChanged(const std::string& id, bool ready) override;
48 void OnTaskCreated(int32_t task_id, 60 void OnTaskCreated(int32_t task_id,
49 const std::string& package_name, 61 const std::string& package_name,
50 const std::string& activity, 62 const std::string& activity,
51 const std::string& intent) override; 63 const std::string& intent) override;
52 void OnTaskDestroyed(int32_t task_id) override; 64 void OnTaskDestroyed(int32_t task_id) override;
53 void OnPackageListInitialRefreshed() override; 65 void OnPackageListInitialRefreshed() override;
54 66
55 // ArcKioskAppManager::Observer overrides 67 // ArcKioskAppManager::Observer overrides
56 void OnArcKioskAppsChanged() override; 68 void OnArcKioskAppsChanged() override;
57 69
58 // ArcKioskBridge::Delegate overrides 70 // ArcKioskBridge::Delegate overrides
59 void OnMaintenanceSessionCreated() override; 71 void OnMaintenanceSessionCreated() override;
60 void OnMaintenanceSessionFinished() override; 72 void OnMaintenanceSessionFinished() override;
61 73
74 // ArcKioskAppLauncher::Delegate overrides
75 void OnAppWindowLaunched() override;
76
62 private: 77 private:
63 explicit ArcKioskAppService(Profile* profile); 78 explicit ArcKioskAppService(Profile* profile);
64 ~ArcKioskAppService() override; 79 ~ArcKioskAppService() override;
65 80
66 std::string GetAppId(); 81 std::string GetAppId();
67 // Called when app should be started or stopped. 82 // Called when app should be started or stopped.
68 void PreconditionsChanged(); 83 void PreconditionsChanged();
69 84
70 Profile* const profile_; 85 Profile* const profile_;
71 bool maintenance_session_running_ = false; 86 bool maintenance_session_running_ = false;
72 ArcKioskAppManager* app_manager_; 87 ArcKioskAppManager* app_manager_;
73 std::string app_id_; 88 std::string app_id_;
74 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info_; 89 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info_;
75 int32_t task_id_ = -1; 90 int32_t task_id_ = -1;
76 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; 91 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
77 // Keeps track whether the app is already launched 92 // Keeps track whether the app is already launched
78 std::unique_ptr<ArcKioskAppLauncher> app_launcher_; 93 std::unique_ptr<ArcKioskAppLauncher> app_launcher_;
79 std::unique_ptr<ArcKioskNotificationBlocker> notification_blocker_; 94 std::unique_ptr<ArcKioskNotificationBlocker> notification_blocker_;
95 // Not owning the delegate, delegate removes itself in destructor
96 Delegate* delegate_ = nullptr;
80 97
81 DISALLOW_COPY_AND_ASSIGN(ArcKioskAppService); 98 DISALLOW_COPY_AND_ASSIGN(ArcKioskAppService);
82 }; 99 };
83 100
84 } // namespace chromeos 101 } // namespace chromeos
85 102
86 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_SERVICE_H_ 103 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698