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

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 456063002: ExtensionUpdater: Abstract ExtensionDownloader creation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments and some cleanup Created 6 years, 4 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/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 68ae5822feb842789917b7326b115b45becdc26e..dee4596c0957a91fe46dd672bdb2ccb9b96c9ece 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -38,6 +38,7 @@
#include "chrome/browser/extensions/shared_module_service.h"
#include "chrome/browser/extensions/unpacked_installer.h"
#include "chrome/browser/extensions/updater/extension_cache.h"
+#include "chrome/browser/extensions/updater/extension_downloader.h"
#include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/profile_identity_provider.h"
@@ -91,6 +92,8 @@ using content::BrowserThread;
using content::DevToolsAgentHost;
using extensions::CrxInstaller;
using extensions::Extension;
+using extensions::ExtensionDownloader;
+using extensions::ExtensionDownloaderDelegate;
using extensions::ExtensionIdSet;
using extensions::ExtensionInfo;
using extensions::ExtensionRegistry;
@@ -321,7 +324,8 @@ ExtensionService::ExtensionService(Profile* profile,
profile,
update_frequency,
extensions::ExtensionCache::GetInstance(),
- CreateWebstoreIdentityProvider(profile_)));
+ base::Bind(&ExtensionService::CreateExtensionDownloader,
+ base::Unretained(this))));
}
component_loader_.reset(
@@ -582,6 +586,20 @@ bool ExtensionService::UpdateExtension(const std::string& id,
return true;
}
+scoped_ptr<ExtensionDownloader> ExtensionService::CreateExtensionDownloader(
+ ExtensionDownloaderDelegate* delegate) {
+ scoped_ptr<ExtensionDownloader> downloader;
+#if defined(ENABLE_EXTENSIONS)
+ scoped_ptr<IdentityProvider> identity_provider =
+ CreateWebstoreIdentityProvider(profile_);
+ downloader.reset(new ExtensionDownloader(
+ delegate,
+ profile_->GetRequestContext()));
+ downloader->SetWebstoreIdentityProvider(identity_provider.Pass());
+#endif
+ return downloader.Pass();
+}
+
void ExtensionService::ReloadExtensionImpl(
// "transient" because the process of reloading may cause the reference
// to become invalid. Instead, use |extension_id|, a copy.
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/extensions/updater/extension_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698