Chromium Code Reviews| OLD | NEW | 
|---|---|
| 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_LAUNCHER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_LAUNCHER_H_ | 
| 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_LAUNCHER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_LAUNCHER_H_ | 
| 7 | 7 | 
| 8 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 8 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 
| 9 #include "ui/aura/env_observer.h" | 9 #include "ui/aura/env_observer.h" | 
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" | 
| 11 #include "ui/aura/window_observer.h" | 11 #include "ui/aura/window_observer.h" | 
| 12 | 12 | 
| 13 namespace chromeos { | 13 namespace chromeos { | 
| 14 | 14 | 
| 15 // Starts Android app in kiosk mode. | 15 // Starts Android app in kiosk mode. | 
| 16 // Keeps track of start progress and pins app window | 16 // Keeps track of start progress and pins app window | 
| 17 // when it's finally opened. | 17 // when it's finally opened. | 
| 18 class ArcKioskAppLauncher : public ArcAppListPrefs::Observer, | 18 class ArcKioskAppLauncher : public ArcAppListPrefs::Observer, | 
| 19 public aura::EnvObserver, | 19 public aura::EnvObserver, | 
| 20 public aura::WindowObserver { | 20 public aura::WindowObserver { | 
| 21 public: | 21 public: | 
| 22 class Delegate { | |
| 23 public: | |
| 24 virtual void OnAppWindowLaunched() = 0; | |
| 25 | |
| 26 protected: | |
| 27 virtual ~Delegate() {} | |
| 
 
Luis Héctor Chávez
2017/01/24 18:40:24
nit: = default
 
Sergey Poromov
2017/01/25 14:29:21
Done.
 
 | |
| 28 }; | |
| 29 | |
| 22 ArcKioskAppLauncher(content::BrowserContext* context, | 30 ArcKioskAppLauncher(content::BrowserContext* context, | 
| 23 ArcAppListPrefs* prefs, | 31 ArcAppListPrefs* prefs, | 
| 24 const std::string& app_id); | 32 const std::string& app_id, | 
| 33 Delegate* delegate); | |
| 25 | 34 | 
| 26 ~ArcKioskAppLauncher() override; | 35 ~ArcKioskAppLauncher() override; | 
| 27 | 36 | 
| 28 // ArcAppListPrefs::Observer overrides. | 37 // ArcAppListPrefs::Observer overrides. | 
| 29 void OnTaskCreated(int32_t task_id, | 38 void OnTaskCreated(int32_t task_id, | 
| 30 const std::string& package_name, | 39 const std::string& package_name, | 
| 31 const std::string& activity, | 40 const std::string& activity, | 
| 32 const std::string& intent) override; | 41 const std::string& intent) override; | 
| 33 | 42 | 
| 34 // aura::EnvObserver overrides. | 43 // aura::EnvObserver overrides. | 
| 35 void OnWindowInitialized(aura::Window* window) override; | 44 void OnWindowInitialized(aura::Window* window) override; | 
| 36 | 45 | 
| 37 // aura::WindowObserver overrides. | 46 // aura::WindowObserver overrides. | 
| 38 void OnWindowPropertyChanged(aura::Window* window, | 47 void OnWindowPropertyChanged(aura::Window* window, | 
| 39 const void* key, | 48 const void* key, | 
| 40 intptr_t old) override; | 49 intptr_t old) override; | 
| 41 void OnWindowDestroying(aura::Window* window) override; | 50 void OnWindowDestroying(aura::Window* window) override; | 
| 42 | 51 | 
| 43 private: | 52 private: | 
| 44 // Check whether it's the app's window and pins it. | 53 // Check whether it's the app's window and pins it. | 
| 45 bool CheckAndPinWindow(aura::Window* const window); | 54 bool CheckAndPinWindow(aura::Window* const window); | 
| 46 void StopObserving(); | 55 void StopObserving(); | 
| 47 | 56 | 
| 48 const std::string app_id_; | 57 const std::string app_id_; | 
| 49 ArcAppListPrefs* const prefs_; | 58 ArcAppListPrefs* const prefs_; | 
| 50 int task_id_ = -1; | 59 int task_id_ = -1; | 
| 51 std::set<aura::Window*> windows_; | 60 std::set<aura::Window*> windows_; | 
| 61 Delegate* delegate_; | |
| 
 
Luis Héctor Chávez
2017/01/24 18:40:24
nit: Delegate* const delegate_;
Also note who own
 
Sergey Poromov
2017/01/25 14:29:21
Done.
 
 | |
| 52 | 62 | 
| 53 DISALLOW_COPY_AND_ASSIGN(ArcKioskAppLauncher); | 63 DISALLOW_COPY_AND_ASSIGN(ArcKioskAppLauncher); | 
| 54 }; | 64 }; | 
| 55 | 65 | 
| 56 } // namespace chromeos | 66 } // namespace chromeos | 
| 57 | 67 | 
| 58 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_LAUNCHER_H_ | 68 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_LAUNCHER_H_ | 
| OLD | NEW |