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