| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_update_install_gate.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "extensions/browser/extension_registry.h" |
| 11 #include "extensions/common/extension.h" |
| 12 |
| 13 namespace chromeos { |
| 14 |
| 15 KioskAppUpdateInstallGate::KioskAppUpdateInstallGate(Profile* profile) |
| 16 : profile_(profile), |
| 17 registry_(extensions::ExtensionRegistry::Get(profile)) {} |
| 18 |
| 19 KioskAppUpdateInstallGate::~KioskAppUpdateInstallGate() {} |
| 20 |
| 21 extensions::InstallGate::Action KioskAppUpdateInstallGate::ShouldDelay( |
| 22 const extensions::Extension* extension, |
| 23 bool install_immediately) { |
| 24 // Install if this is the first install or the required platform version is |
| 25 // compliant with the current platform version. |
| 26 const bool first_install = !registry_->GetInstalledExtension(extension->id()); |
| 27 const bool platform_compliant = |
| 28 KioskAppManager::Get()->IsPlatformCompliantWithApp(extension); |
| 29 if (first_install || platform_compliant) { |
| 30 LOG_IF(WARNING, first_install && !platform_compliant) |
| 31 << "Install on an incompliant platform for the first install."; |
| 32 return INSTALL; |
| 33 } |
| 34 |
| 35 // Otherwise, delay install but update the required platform version meta data |
| 36 // to allow update engine to move on to the new platform version. |
| 37 KioskAppManager::Get()->UpdateAppDataFromProfile(extension->id(), profile_, |
| 38 extension); |
| 39 return DELAY; |
| 40 } |
| 41 |
| 42 } // namespace chromeos |
| OLD | NEW |