| 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 #include <chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.h> | 5 #include <chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.h> |
| 6 | 6 |
| 7 #include <memory> |
| 8 #include <string> |
| 9 |
| 7 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| 8 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 11 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
| 9 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" | 12 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" |
| 10 #include "ui/aura/env.h" | 13 #include "ui/aura/env.h" |
| 14 #include "ui/events/event_constants.h" |
| 11 | 15 |
| 12 namespace chromeos { | 16 namespace chromeos { |
| 13 | 17 |
| 14 ArcKioskAppLauncher::ArcKioskAppLauncher(content::BrowserContext* context, | 18 ArcKioskAppLauncher::ArcKioskAppLauncher(content::BrowserContext* context, |
| 15 ArcAppListPrefs* prefs, | 19 ArcAppListPrefs* prefs, |
| 16 const std::string& app_id) | 20 const std::string& app_id) |
| 17 : app_id_(app_id), prefs_(prefs) { | 21 : app_id_(app_id), prefs_(prefs) { |
| 18 prefs_->AddObserver(this); | 22 prefs_->AddObserver(this); |
| 19 aura::Env::GetInstance()->AddObserver(this); | 23 aura::Env::GetInstance()->AddObserver(this); |
| 20 // Launching the app by app id in landscape mode. | 24 // Launching the app by app id in landscape mode. |
| 21 arc::LaunchApp(context, app_id_); | 25 arc::LaunchApp(context, app_id_, ui::EF_NONE); |
| 22 } | 26 } |
| 23 | 27 |
| 24 ArcKioskAppLauncher::~ArcKioskAppLauncher() { | 28 ArcKioskAppLauncher::~ArcKioskAppLauncher() { |
| 25 StopObserving(); | 29 StopObserving(); |
| 26 } | 30 } |
| 27 | 31 |
| 28 void ArcKioskAppLauncher::OnTaskCreated(int32_t task_id, | 32 void ArcKioskAppLauncher::OnTaskCreated(int32_t task_id, |
| 29 const std::string& package_name, | 33 const std::string& package_name, |
| 30 const std::string& activity) { | 34 const std::string& activity) { |
| 31 std::unique_ptr<ArcAppListPrefs::AppInfo> app = prefs_->GetApp(app_id_); | 35 std::unique_ptr<ArcAppListPrefs::AppInfo> app = prefs_->GetApp(app_id_); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 82 |
| 79 void ArcKioskAppLauncher::StopObserving() { | 83 void ArcKioskAppLauncher::StopObserving() { |
| 80 aura::Env::GetInstance()->RemoveObserver(this); | 84 aura::Env::GetInstance()->RemoveObserver(this); |
| 81 for (auto* window : windows_) | 85 for (auto* window : windows_) |
| 82 window->RemoveObserver(this); | 86 window->RemoveObserver(this); |
| 83 windows_.clear(); | 87 windows_.clear(); |
| 84 prefs_->RemoveObserver(this); | 88 prefs_->RemoveObserver(this); |
| 85 } | 89 } |
| 86 | 90 |
| 87 } // namespace chromeos | 91 } // namespace chromeos |
| OLD | NEW |