| Index: chrome/browser/chromeos/app_mode/kiosk_app_manager.cc
|
| diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_manager.cc b/chrome/browser/chromeos/app_mode/kiosk_app_manager.cc
|
| index 3dff8f1607ec049bde2683d9ba65d7c4e0860062..2f81c6ec4f77e76f620086537880c5d4ac96876d 100644
|
| --- a/chrome/browser/chromeos/app_mode/kiosk_app_manager.cc
|
| +++ b/chrome/browser/chromeos/app_mode/kiosk_app_manager.cc
|
| @@ -18,12 +18,14 @@
|
| #include "base/sys_info.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/chromeos/app_mode/kiosk_app_data.h"
|
| +#include "chrome/browser/chromeos/app_mode/kiosk_app_external_loader.h"
|
| #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h"
|
| #include "chrome/browser/chromeos/login/users/user_manager.h"
|
| #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
|
| #include "chrome/browser/chromeos/policy/device_local_account.h"
|
| #include "chrome/browser/chromeos/settings/cros_settings.h"
|
| #include "chrome/browser/chromeos/settings/owner_key_util.h"
|
| +#include "chrome/browser/extensions/external_loader.h"
|
| #include "chrome/browser/extensions/external_provider_impl.h"
|
| #include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/extensions/extension_constants.h"
|
| @@ -356,6 +358,21 @@ void KioskAppManager::UpdateAppDataFromProfile(
|
| app_data->LoadFromInstalledApp(profile, app);
|
| }
|
|
|
| +bool KioskAppManager::GetCachedCrx(const std::string& app_id,
|
| + base::FilePath* file_path,
|
| + std::string* version) {
|
| + return external_cache_->GetExtension(app_id, file_path, version);
|
| +}
|
| +
|
| +bool KioskAppManager::IsExtensionPendingForCache(const std::string& id) {
|
| + return external_cache_->IsExtensionPending(id) &&
|
| + !external_cache_->IsExtensionDownloadFailed(id);
|
| +}
|
| +
|
| +bool KioskAppManager::IsExtensionPendingForUpdateCheck(const std::string& id) {
|
| + return external_cache_->IsExtensionPendingForUpdateCheck(id);
|
| +}
|
| +
|
| void KioskAppManager::AddObserver(KioskAppManagerObserver* observer) {
|
| observers_.AddObserver(observer);
|
| }
|
| @@ -364,7 +381,33 @@ void KioskAppManager::RemoveObserver(KioskAppManagerObserver* observer) {
|
| observers_.RemoveObserver(observer);
|
| }
|
|
|
| -KioskAppManager::KioskAppManager() : ownership_established_(false) {
|
| +extensions::ExternalLoader* KioskAppManager::CreateExternalLoader() {
|
| + if (external_loader_created_) {
|
| + NOTREACHED();
|
| + return NULL;
|
| + }
|
| + external_loader_created_ = true;
|
| + KioskAppExternalLoader* loader = new KioskAppExternalLoader();
|
| + external_loader_ = loader->AsWeakPtr();
|
| +
|
| + return loader;
|
| +}
|
| +
|
| +void KioskAppManager::InstallKioskApp(const std::string& id) {
|
| + const base::DictionaryValue* extension = NULL;
|
| + if (external_cache_->cached_extensions()->GetDictionary(id, &extension)) {
|
| + scoped_ptr<base::DictionaryValue> prefs(new base::DictionaryValue);
|
| + base::DictionaryValue* extension_copy = extension->DeepCopy();
|
| + prefs->Set(id, extension_copy);
|
| + external_loader_->SetCurrentAppExtensions(prefs.Pass());
|
| + } else {
|
| + LOG(ERROR) << "Can't find app in the cached externsions"
|
| + << " id = " << id;
|
| + }
|
| +}
|
| +
|
| +KioskAppManager::KioskAppManager()
|
| + : ownership_established_(false), external_loader_created_(false) {
|
| base::FilePath cache_dir;
|
| GetCrxCacheDir(&cache_dir);
|
| external_cache_.reset(
|
| @@ -536,10 +579,4 @@ void KioskAppManager::GetCrxCacheDir(base::FilePath* cache_dir) {
|
| *cache_dir = user_data_dir.AppendASCII(kCrxCacheDir);
|
| }
|
|
|
| -bool KioskAppManager::GetCachedCrx(const std::string& app_id,
|
| - base::FilePath* file_path,
|
| - std::string* version) {
|
| - return external_cache_->GetExtension(app_id, file_path, version);
|
| -}
|
| -
|
| } // namespace chromeos
|
|
|