diff options
author | joaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-20 02:07:51 +0000 |
---|---|---|
committer | joaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-20 02:07:51 +0000 |
commit | 944dfa8e08e7bc93400b4fa9ef83fdcd82f63a74 (patch) | |
tree | 256cfaae5c050b95cacb6f5a9574250fcb1a7f48 /chrome/browser/extensions | |
parent | 1903e1981631ce99a9e5539e2596ea90695db82f (diff) | |
download | chromium_src-944dfa8e08e7bc93400b4fa9ef83fdcd82f63a74.zip chromium_src-944dfa8e08e7bc93400b4fa9ef83fdcd82f63a74.tar.gz chromium_src-944dfa8e08e7bc93400b4fa9ef83fdcd82f63a74.tar.bz2 |
Implemented the AppPackUpdater.
This initial version downloads the AppPack extensions, installs them in the
cache and pushes them to the demo user at login time.
BUG=chromium-os:25463
TEST=Push AppPack extensions and set retail mode through device policy. Those extensions are installed for the demo user.
Review URL: http://codereview.chromium.org/9699118
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127617 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
7 files changed, 33 insertions, 5 deletions
diff --git a/chrome/browser/extensions/external_extension_provider_impl.cc b/chrome/browser/extensions/external_extension_provider_impl.cc index 6c9c50d..c471ce3 100644 --- a/chrome/browser/extensions/external_extension_provider_impl.cc +++ b/chrome/browser/extensions/external_extension_provider_impl.cc @@ -25,6 +25,12 @@ #include "content/public/browser/browser_thread.h" #include "ui/base/l10n/l10n_util.h" +#if defined(OS_CHROMEOS) +#include "chrome/browser/chromeos/login/user_manager.h" +#include "chrome/browser/policy/app_pack_updater.h" +#include "chrome/browser/policy/browser_policy_connector.h" +#endif + #if !defined(OS_CHROMEOS) #include "chrome/browser/extensions/default_apps.h" #endif @@ -372,4 +378,22 @@ void ExternalExtensionProviderImpl::CreateExternalProviders( Extension::INVALID, Extension::FROM_BOOKMARK))); #endif + +#if defined(OS_CHROMEOS) + chromeos::UserManager* user_manager = chromeos::UserManager::Get(); + policy::BrowserPolicyConnector* connector = + g_browser_process->browser_policy_connector(); + if (user_manager && user_manager->IsLoggedInAsDemoUser() && + connector->GetDeviceMode() == policy::DEVICE_MODE_KIOSK && + connector->GetAppPackUpdater()) { + provider_list->push_back( + linked_ptr<ExternalExtensionProviderInterface>( + new ExternalExtensionProviderImpl( + service, + connector->GetAppPackUpdater()->CreateExternalExtensionLoader(), + Extension::EXTERNAL_PREF, + Extension::INVALID, + Extension::NO_FLAGS))); + } +#endif } diff --git a/chrome/browser/extensions/external_extension_provider_impl.h b/chrome/browser/extensions/external_extension_provider_impl.h index 50349a5..b65edd2 100644 --- a/chrome/browser/extensions/external_extension_provider_impl.h +++ b/chrome/browser/extensions/external_extension_provider_impl.h @@ -65,8 +65,6 @@ class ExternalExtensionProviderImpl virtual bool IsReady() const OVERRIDE; virtual int GetCreationFlags() const OVERRIDE; - static const char kLocation[]; - static const char kState[]; static const char kExternalCrx[]; static const char kExternalVersion[]; static const char kExternalUpdateUrl[]; diff --git a/chrome/browser/extensions/updater/extension_downloader.cc b/chrome/browser/extensions/updater/extension_downloader.cc index fbf960f..9f345f4 100644 --- a/chrome/browser/extensions/updater/extension_downloader.cc +++ b/chrome/browser/extensions/updater/extension_downloader.cc @@ -605,7 +605,9 @@ void ExtensionDownloader::OnCRXFetchComplete( // Take ownership of the file at |crx_path|. CHECK(source->GetResponseAsFilePath(true, &crx_path)); RecordCRXWriteHistogram(true, crx_path); - delegate_->OnExtensionDownloadFinished(id, crx_path, url, ping); + delegate_->OnExtensionDownloadFinished(id, crx_path, url, + current_extension_fetch_.version, + ping); } } else { // TODO(asargent) do things like exponential backoff, handling diff --git a/chrome/browser/extensions/updater/extension_downloader_delegate.h b/chrome/browser/extensions/updater/extension_downloader_delegate.h index 4171eeb..65debe4 100644 --- a/chrome/browser/extensions/updater/extension_downloader_delegate.h +++ b/chrome/browser/extensions/updater/extension_downloader_delegate.h @@ -66,11 +66,12 @@ class ExtensionDownloaderDelegate { const PingResult& ping_result); // Invoked if the extension had an update available and its crx was - // successfully downloaded to |path|. Ownership if that file is transferred + // successfully downloaded to |path|. Ownership of that file is transferred // to the delegate. virtual void OnExtensionDownloadFinished(const std::string& id, const FilePath& path, const GURL& download_url, + const std::string& version, const PingResult& ping_result) = 0; // Same as OnExtensionDownloadFinished() but only for the kBlacklistAppID diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc index ff3fdaf..9b00ee0 100644 --- a/chrome/browser/extensions/updater/extension_updater.cc +++ b/chrome/browser/extensions/updater/extension_updater.cc @@ -343,6 +343,7 @@ void ExtensionUpdater::OnExtensionDownloadFailed(const std::string& id, void ExtensionUpdater::OnExtensionDownloadFinished(const std::string& id, const FilePath& path, const GURL& download_url, + const std::string& version, const PingResult& ping) { DCHECK(alive_); UpdatePingData(id, ping); diff --git a/chrome/browser/extensions/updater/extension_updater.h b/chrome/browser/extensions/updater/extension_updater.h index 53d4719..4cb99e7 100644 --- a/chrome/browser/extensions/updater/extension_updater.h +++ b/chrome/browser/extensions/updater/extension_updater.h @@ -123,6 +123,7 @@ class ExtensionUpdater : public ExtensionDownloaderDelegate, virtual void OnExtensionDownloadFinished(const std::string& id, const FilePath& path, const GURL& download_url, + const std::string& version, const PingResult& ping) OVERRIDE; virtual void OnBlacklistDownloadFinished(const std::string& data, diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index 825921d..33b7cdfd 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc @@ -77,9 +77,10 @@ class MockExtensionDownloaderDelegate : public ExtensionDownloaderDelegate { public: MOCK_METHOD3(OnExtensionDownloadFailed, void(const std::string&, Error, const PingResult&)); - MOCK_METHOD4(OnExtensionDownloadFinished, void(const std::string&, + MOCK_METHOD5(OnExtensionDownloadFinished, void(const std::string&, const FilePath&, const GURL&, + const std::string&, const PingResult&)); MOCK_METHOD4(OnBlacklistDownloadFinished, void(const std::string&, const std::string&, |