Chromium Code Reviews| Index: chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.h |
| diff --git a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.h b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ef13b99cab161e94dd6e2d50ef94504180ffa365 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.h |
| @@ -0,0 +1,56 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_LAUNCHER_H_ |
| +#define CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_LAUNCHER_H_ |
| + |
| +#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| +#include "ui/aura/env_observer.h" |
| +#include "ui/aura/window.h" |
| +#include "ui/aura/window_observer.h" |
| + |
| +namespace chromeos { |
| + |
| +// Starts Android app in kiosk mode. |
| +// Keeps track of start progress and pins app window |
| +// when it's finally opened. |
| +class ArcKioskAppLauncher : public ArcAppListPrefs::Observer, |
| + public aura::EnvObserver, |
| + public aura::WindowObserver { |
| + public: |
| + ArcKioskAppLauncher(content::BrowserContext* context, |
| + const std::string& app_id); |
| + |
| + ~ArcKioskAppLauncher() override; |
| + |
| + // ArcAppListPrefs::Observer overrides. |
| + void OnTaskCreated(int32_t task_id, |
| + const std::string& package_name, |
| + const std::string& activity) override; |
| + |
| + // aura::EnvObserver overrides. |
| + void OnWindowInitialized(aura::Window* window) override; |
| + |
| + // aura::WindowObserver overrides. |
| + void OnWindowPropertyChanged(aura::Window* window, |
| + const void* key, |
| + intptr_t old) override; |
| + void OnWindowDestroying(aura::Window* window) override; |
| + |
| + private: |
| + // Check whether it's the app's window and pins it. |
| + bool CheckWindow(aura::Window* const window); |
|
Luis Héctor Chávez
2016/11/16 16:37:12
You need to add the pinning part of the intention
Sergey Poromov
2016/11/16 17:42:13
It both checks and pins the window if needed, so C
|
| + void StopObserving(); |
| + |
| + std::string app_id_; |
|
Luis Héctor Chávez
2016/11/16 16:37:12
nit: const std::string app_id_;
Sergey Poromov
2016/11/16 17:42:13
Done.
|
| + ArcAppListPrefs* prefs_; |
|
Luis Héctor Chávez
2016/11/16 16:37:11
nit: ArcAppListPrefs* const prefs_;
Sergey Poromov
2016/11/16 17:42:13
Done.
|
| + int task_id_ = -1; |
| + std::set<aura::Window*> windows_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ArcKioskAppLauncher); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_APP_MODE_ARC_ARC_KIOSK_APP_LAUNCHER_H_ |