| Index: chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.cc
|
| diff --git a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.cc b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.cc
|
| index 826b62768de907da5a892d9e4a2e7d6cee8589ee..b84c394e7bf77b03179a8af3e98923ff09c17d61 100644
|
| --- a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.cc
|
| +++ b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.cc
|
| @@ -51,6 +51,10 @@ ArcKioskAppService* ArcKioskAppService::Get(content::BrowserContext* context) {
|
| return ArcKioskAppServiceFactory::GetForBrowserContext(context);
|
| }
|
|
|
| +void ArcKioskAppService::SetDelegate(Delegate* delegate) {
|
| + delegate_ = delegate;
|
| +}
|
| +
|
| void ArcKioskAppService::Shutdown() {
|
| ArcAppListPrefs::Get(profile_)->RemoveObserver(this);
|
| app_manager_->RemoveObserver(this);
|
| @@ -59,10 +63,14 @@ void ArcKioskAppService::Shutdown() {
|
| void ArcKioskAppService::OnAppRegistered(
|
| const std::string& app_id,
|
| const ArcAppListPrefs::AppInfo& app_info) {
|
| + if (!app_id_.empty() && app_id != app_id_)
|
| + return;
|
| PreconditionsChanged();
|
| }
|
|
|
| void ArcKioskAppService::OnAppReadyChanged(const std::string& id, bool ready) {
|
| + if (!app_id_.empty() && id != app_id_)
|
| + return;
|
| PreconditionsChanged();
|
| }
|
|
|
| @@ -83,6 +91,8 @@ void ArcKioskAppService::OnTaskCreated(int32_t task_id,
|
| if (app_info_ && package_name == app_info_->package_name &&
|
| activity == app_info_->activity) {
|
| task_id_ = task_id;
|
| + if (delegate_)
|
| + delegate_->OnAppStarted();
|
| }
|
| }
|
|
|
| @@ -106,6 +116,11 @@ void ArcKioskAppService::OnMaintenanceSessionFinished() {
|
| PreconditionsChanged();
|
| }
|
|
|
| +void ArcKioskAppService::OnAppWindowLaunched() {
|
| + if (delegate_)
|
| + delegate_->OnAppWindowLaunched();
|
| +}
|
| +
|
| ArcKioskAppService::ArcKioskAppService(Profile* profile) : profile_(profile) {
|
| ArcAppListPrefs::Get(profile_)->AddObserver(this);
|
| app_manager_ = ArcKioskAppManager::Get();
|
| @@ -133,8 +148,8 @@ void ArcKioskAppService::PreconditionsChanged() {
|
| profile_->GetPrefs()->GetBoolean(prefs::kArcPolicyCompliant) &&
|
| !maintenance_session_running_) {
|
| if (!app_launcher_)
|
| - app_launcher_.reset(new ArcKioskAppLauncher(
|
| - profile_, ArcAppListPrefs::Get(profile_), app_id_));
|
| + app_launcher_ = base::MakeUnique<ArcKioskAppLauncher>(
|
| + profile_, ArcAppListPrefs::Get(profile_), app_id_, this);
|
| } else if (task_id_ != -1) {
|
| arc::CloseTask(task_id_);
|
| }
|
|
|