| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 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_ |
| 7 |
| 8 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 9 #include "ui/aura/env_observer.h" |
| 10 #include "ui/aura/window.h" |
| 11 #include "ui/aura/window_observer.h" |
| 12 |
| 13 namespace chromeos { |
| 14 |
| 15 // Starts Android app in kiosk mode. |
| 16 // Keeps track of start progress and pins app window |
| 17 // when it's finally opened. |
| 18 class ArcKioskAppLauncher : public ArcAppListPrefs::Observer, |
| 19 public aura::EnvObserver, |
| 20 public aura::WindowObserver { |
| 21 public: |
| 22 ArcKioskAppLauncher(content::BrowserContext* context, |
| 23 ArcAppListPrefs* prefs, |
| 24 const std::string& app_id); |
| 25 |
| 26 ~ArcKioskAppLauncher() override; |
| 27 |
| 28 // ArcAppListPrefs::Observer overrides. |
| 29 void OnTaskCreated(int32_t task_id, |
| 30 const std::string& package_name, |
| 31 const std::string& activity) override; |
| 32 |
| 33 // aura::EnvObserver overrides. |
| 34 void OnWindowInitialized(aura::Window* window) override; |
| 35 |
| 36 // aura::WindowObserver overrides. |
| 37 void OnWindowPropertyChanged(aura::Window* window, |
| 38 const void* key, |
| 39 intptr_t old) override; |
| 40 void OnWindowDestroying(aura::Window* window) override; |
| 41 |
| 42 private: |
| 43 // Check whether it's the app's window and pins it. |
| 44 bool CheckAndPinWindow(aura::Window* const window); |
| 45 void StopObserving(); |
| 46 |
| 47 const std::string app_id_; |
| 48 ArcAppListPrefs* const prefs_; |
| 49 int task_id_ = -1; |
| 50 std::set<aura::Window*> windows_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(ArcKioskAppLauncher); |
| 53 }; |
| 54 |
| 55 } // namespace chromeos |
| 56 |
| 57 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_LAUNCHER_H_ |
| OLD | NEW |