Chromium Code Reviews| 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..1e5deefd8ddc19160876f8f65b6cd665671d0092 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/app_mode/kiosk_app_update_install_gate.cc |
| @@ -0,0 +1,37 @@ |
| +// 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 "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. |
| + if (!registry_->GetInstalledExtension(extension->id()) || |
|
jennyz
2016/04/19 21:54:28
For first install case, if the required platform v
xiyuan
2016/04/19 22:28:45
Done.
|
| + KioskAppManager::Get()->IsPlatformCompliantWithApp(extension)) { |
| + 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 |