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_service.h> | 5 #include <chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h> |
6 | 6 |
7 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service_factory.h" | 7 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service_factory.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
10 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" | 10 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 if (app_info_ && package_name == app_info_->package_name && | 52 if (app_info_ && package_name == app_info_->package_name && |
53 activity == app_info_->activity) { | 53 activity == app_info_->activity) { |
54 task_id_ = task_id; | 54 task_id_ = task_id; |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 void ArcKioskAppService::OnTaskDestroyed(int32_t task_id) { | 58 void ArcKioskAppService::OnTaskDestroyed(int32_t task_id) { |
59 if (task_id == task_id_) { | 59 if (task_id == task_id_) { |
60 app_launcher_.reset(); | 60 app_launcher_.reset(); |
61 task_id_ = -1; | 61 task_id_ = -1; |
62 // Trying to restart app if it was somehow closed or crashed | |
63 // as kiosk app should always be running during the session. | |
64 PreconditionsChanged(); | |
khmel
2016/12/26 20:29:38
I found 2 handlers:
ArcKioskAppLauncher::OnTaskCr
| |
62 } | 65 } |
63 } | 66 } |
64 | 67 |
65 ArcKioskAppService::ArcKioskAppService(Profile* profile, ArcAppListPrefs* prefs) | 68 ArcKioskAppService::ArcKioskAppService(Profile* profile, ArcAppListPrefs* prefs) |
66 : profile_(profile), prefs_(prefs) { | 69 : profile_(profile), prefs_(prefs) { |
67 if (prefs_) | 70 if (prefs_) |
68 prefs_->AddObserver(this); | 71 prefs_->AddObserver(this); |
69 app_manager_ = ArcKioskAppManager::Get(); | 72 app_manager_ = ArcKioskAppManager::Get(); |
70 if (app_manager_) { | 73 if (app_manager_) { |
71 app_manager_->AddObserver(this); | 74 app_manager_->AddObserver(this); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 std::unordered_set<std::string> app_ids = | 113 std::unordered_set<std::string> app_ids = |
111 prefs_->GetAppsForPackage(app->app_info().package_name()); | 114 prefs_->GetAppsForPackage(app->app_info().package_name()); |
112 if (app_ids.empty()) | 115 if (app_ids.empty()) |
113 return std::string(); | 116 return std::string(); |
114 // TODO(poromov@): Choose appropriate app id to launch. See | 117 // TODO(poromov@): Choose appropriate app id to launch. See |
115 // http://crbug.com/665904 | 118 // http://crbug.com/665904 |
116 return std::string(*app_ids.begin()); | 119 return std::string(*app_ids.begin()); |
117 } | 120 } |
118 | 121 |
119 } // namespace chromeos | 122 } // namespace chromeos |
OLD | NEW |