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

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: Created 3 years, 11 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 13 matching lines...) Expand all
24 // Keeps track of ARC session state and auto-launches kiosk app when it's ready. 24 // Keeps track of ARC session state and auto-launches kiosk app when it's ready.
25 // App is started when the following conditions are satisfied: 25 // App is started when the following conditions are satisfied:
26 // 1. App id is registered in ArcAppListPrefs and set to "ready" state. 26 // 1. App id is registered in ArcAppListPrefs and set to "ready" state.
27 // 2. Got empty policy compliance report from Android 27 // 2. Got empty policy compliance report from Android
28 // 3. App is not yet started 28 // 3. App is not yet started
29 // Also, the app is stopped when one of above conditions changes. 29 // Also, the app is stopped when one of above conditions changes.
30 class ArcKioskAppService 30 class ArcKioskAppService
31 : public KeyedService, 31 : public KeyedService,
32 public ArcAppListPrefs::Observer, 32 public ArcAppListPrefs::Observer,
33 public ArcKioskAppManager::ArcKioskAppManagerObserver, 33 public ArcKioskAppManager::ArcKioskAppManagerObserver,
34 public arc::ArcKioskBridge::Delegate { 34 public arc::ArcKioskBridge::Delegate,
35 public ArcKioskAppLauncher::Delegate {
35 public: 36 public:
37 class Delegate {
38 public:
39 virtual void OnAppStarted() = 0;
40 virtual void OnAppWindowLaunched() = 0;
41
42 protected:
43 virtual ~Delegate() {}
Luis Héctor Chávez 2017/01/24 18:40:24 nit: = default
Sergey Poromov 2017/01/25 14:29:21 Done.
44 };
45
36 static ArcKioskAppService* Create(Profile* profile); 46 static ArcKioskAppService* Create(Profile* profile);
37 static ArcKioskAppService* Get(content::BrowserContext* context); 47 static ArcKioskAppService* Get(content::BrowserContext* context);
38 48
49 void SetDelegate(Delegate* delegate);
50
39 // KeyedService overrides 51 // KeyedService overrides
40 void Shutdown() override; 52 void Shutdown() override;
41 53
42 // ArcAppListPrefs::Observer overrides 54 // ArcAppListPrefs::Observer overrides
43 void OnAppRegistered(const std::string& app_id, 55 void OnAppRegistered(const std::string& app_id,
44 const ArcAppListPrefs::AppInfo& app_info) override; 56 const ArcAppListPrefs::AppInfo& app_info) override;
45 void OnAppReadyChanged(const std::string& id, bool ready) override; 57 void OnAppReadyChanged(const std::string& id, bool ready) override;
46 void OnTaskCreated(int32_t task_id, 58 void OnTaskCreated(int32_t task_id,
47 const std::string& package_name, 59 const std::string& package_name,
48 const std::string& activity, 60 const std::string& activity,
49 const std::string& intent) override; 61 const std::string& intent) override;
50 void OnTaskDestroyed(int32_t task_id) override; 62 void OnTaskDestroyed(int32_t task_id) override;
51 void OnPackageListInitialRefreshed() override; 63 void OnPackageListInitialRefreshed() override;
52 64
53 // ArcKioskAppManager::Observer overrides 65 // ArcKioskAppManager::Observer overrides
54 void OnArcKioskAppsChanged() override; 66 void OnArcKioskAppsChanged() override;
55 67
56 // ArcKioskBridge::Delegate overrides 68 // ArcKioskBridge::Delegate overrides
57 void OnMaintenanceSessionCreated() override; 69 void OnMaintenanceSessionCreated() override;
58 void OnMaintenanceSessionFinished() override; 70 void OnMaintenanceSessionFinished() override;
59 71
72 // ArcKioskAppLauncher::Delegate overrides
73 void OnAppWindowLaunched() override;
74
60 private: 75 private:
61 explicit ArcKioskAppService(Profile* profile); 76 explicit ArcKioskAppService(Profile* profile);
62 ~ArcKioskAppService() override; 77 ~ArcKioskAppService() override;
63 78
64 std::string GetAppId(); 79 std::string GetAppId();
65 // Called when app should be started or stopped. 80 // Called when app should be started or stopped.
66 void PreconditionsChanged(); 81 void PreconditionsChanged();
67 82
68 Profile* const profile_; 83 Profile* const profile_;
69 bool maintenance_session_running_ = false; 84 bool maintenance_session_running_ = false;
70 ArcKioskAppManager* app_manager_; 85 ArcKioskAppManager* app_manager_;
71 std::string app_id_; 86 std::string app_id_;
72 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info_; 87 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info_;
73 int32_t task_id_ = -1; 88 int32_t task_id_ = -1;
74 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; 89 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_;
75 // Keeps track whether the app is already launched 90 // Keeps track whether the app is already launched
76 std::unique_ptr<ArcKioskAppLauncher> app_launcher_; 91 std::unique_ptr<ArcKioskAppLauncher> app_launcher_;
92 Delegate* delegate_ = nullptr;
Luis Héctor Chávez 2017/01/24 18:40:24 Please note who owns this and its lifetime.
Sergey Poromov 2017/01/25 14:29:21 Done.
77 93
78 DISALLOW_COPY_AND_ASSIGN(ArcKioskAppService); 94 DISALLOW_COPY_AND_ASSIGN(ArcKioskAppService);
79 }; 95 };
80 96
81 } // namespace chromeos 97 } // namespace chromeos
82 98
83 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_SERVICE_H_ 99 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698