Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Unified Diff: chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.cc

Issue 2524673003: arc: Stop/start ARC++ kiosk app when maintenance session started/finished. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ArcKioskBridge::Delegate. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 b9435042b0381fb415e516b1c315eb791a2f66f0..7ee6dab99b2873ca887f5249fca6e9f1038f9a7c 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
@@ -15,13 +15,12 @@
namespace chromeos {
// static
-ArcKioskAppService* ArcKioskAppService::Create(Profile* profile,
- ArcAppListPrefs* prefs) {
- return new ArcKioskAppService(profile, prefs);
+ArcKioskAppService* ArcKioskAppService::Create(Profile* profile) {
+ return new ArcKioskAppService(profile);
}
// static
-ArcKioskAppService* ArcKioskAppService::Get(content::BrowserContext* context) {
+ArcKioskAppService* ArcKioskAppService::Get(Profile* context) {
Luis Héctor Chávez 2016/12/01 20:13:33 This doesn't need to change. Profile is-a content:
Sergey Poromov 2016/12/16 16:12:05 Done.
return ArcKioskAppServiceFactory::GetForBrowserContext(context);
}
@@ -65,8 +64,20 @@ void ArcKioskAppService::OnTaskDestroyed(int32_t task_id) {
}
}
-ArcKioskAppService::ArcKioskAppService(Profile* profile, ArcAppListPrefs* prefs)
- : profile_(profile), prefs_(prefs) {
+void ArcKioskAppService::OnMaintenanceSessionCreated() {
+ maintenance_session_running_ = true;
+ PreconditionsChanged();
+}
+
+void ArcKioskAppService::OnMaintenanceSessionFinished() {
+ maintenance_session_running_ = false;
+ PreconditionsChanged();
+}
+
+ArcKioskAppService::ArcKioskAppService(Profile* profile)
+ : profile_(profile),
+ prefs_(ArcAppListPrefs::Get(profile)),
Luis Héctor Chávez 2016/12/01 20:13:33 Remove this line and then s/prefs_/ArcAppListPrefs
Sergey Poromov 2016/12/16 16:12:05 Done.
+ maintenance_session_running_(false) {
if (prefs_)
prefs_->AddObserver(this);
app_manager_ = ArcKioskAppManager::Get();
@@ -94,7 +105,8 @@ ArcKioskAppService::~ArcKioskAppService() {
void ArcKioskAppService::PreconditionsChanged() {
app_info_ = prefs_->GetApp(app_id_);
if (app_info_ && app_info_->ready &&
- profile_->GetPrefs()->GetBoolean(prefs::kArcPolicyCompliant)) {
+ profile_->GetPrefs()->GetBoolean(prefs::kArcPolicyCompliant) &&
+ !maintenance_session_running_) {
if (!app_launcher_)
app_launcher_.reset(new ArcKioskAppLauncher(profile_, prefs_, app_id_));
} else if (task_id_ != -1) {

Powered by Google App Engine
This is Rietveld 408576698