| 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 const std::string& app_id); |
| 24 |
| 25 ~ArcKioskAppLauncher() override; |
| 26 |
| 27 // ArcAppListPrefs::Observer overrides. |
| 28 void OnTaskCreated(int32_t task_id, |
| 29 const std::string& package_name, |
| 30 const std::string& activity) override; |
| 31 |
| 32 // aura::EnvObserver overrides. |
| 33 void OnWindowInitialized(aura::Window* window) override; |
| 34 |
| 35 // aura::WindowObserver overrides. |
| 36 void OnWindowPropertyChanged(aura::Window* window, |
| 37 const void* key, |
| 38 intptr_t old) override; |
| 39 void OnWindowDestroying(aura::Window* window) override; |
| 40 |
| 41 private: |
| 42 // Check whether it's the app's window and pins it. |
| 43 bool CheckAndPinWindow(aura::Window* const window); |
| 44 void StopObserving(); |
| 45 |
| 46 const std::string app_id_; |
| 47 ArcAppListPrefs* const prefs_; |
| 48 int task_id_ = -1; |
| 49 std::set<aura::Window*> windows_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(ArcKioskAppLauncher); |
| 52 }; |
| 53 |
| 54 } // namespace chromeos |
| 55 |
| 56 #endif // CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_LAUNCHER_H_ |
| OLD | NEW |