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

Unified Diff: chrome/browser/chromeos/app_mode/kiosk_app_update_install_gate.cc

Issue 1869483002: kiosk: Defer app update until platform matches (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for comments from jenny Created 4 years, 8 months 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/kiosk_app_update_install_gate.cc
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_update_install_gate.cc b/chrome/browser/chromeos/app_mode/kiosk_app_update_install_gate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..333f6fb3f2692a5f41ef21af1797da97bc1f6cf7
--- /dev/null
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_update_install_gate.cc
@@ -0,0 +1,42 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/app_mode/kiosk_app_update_install_gate.h"
+
+#include "base/logging.h"
+#include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
+#include "chrome/browser/profiles/profile.h"
+#include "extensions/browser/extension_registry.h"
+#include "extensions/common/extension.h"
+
+namespace chromeos {
+
+KioskAppUpdateInstallGate::KioskAppUpdateInstallGate(Profile* profile)
+ : profile_(profile),
+ registry_(extensions::ExtensionRegistry::Get(profile)) {}
+
+KioskAppUpdateInstallGate::~KioskAppUpdateInstallGate() {}
+
+extensions::InstallGate::Action KioskAppUpdateInstallGate::ShouldDelay(
+ const extensions::Extension* extension,
+ bool install_immediately) {
+ // Install if this is the first install or the required platform version is
+ // compliant with the current platform version.
+ const bool first_install = !registry_->GetInstalledExtension(extension->id());
+ const bool platform_compliant =
+ KioskAppManager::Get()->IsPlatformCompliantWithApp(extension);
+ if (first_install || platform_compliant) {
+ LOG_IF(WARNING, first_install && !platform_compliant)
+ << "Install on an incompliant platform for the first install.";
+ return INSTALL;
+ }
+
+ // Otherwise, delay install but update the required platform version meta data
+ // to allow update engine to move on to the new platform version.
+ KioskAppManager::Get()->UpdateAppDataFromProfile(extension->id(), profile_,
+ extension);
+ return DELAY;
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698