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

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

Issue 160483: Ever closer. Extract a client interface out of CrxInstaller and (Closed)
Patch Set: nits Created 11 years, 5 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/extensions_service.cc
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index adc554fa0a94cb2d6c9cb91d58f0c88d76a36da6..9f3aefc1fcbb398591a3f98e0efec7a3eaee3c4f 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -14,9 +14,7 @@
#include "chrome/browser/extensions/extension_updater.h"
#include "chrome/browser/extensions/external_extension_provider.h"
#include "chrome/browser/extensions/external_pref_extension_provider.h"
-#include "chrome/browser/extensions/theme_preview_infobar_delegate.h"
#include "chrome/browser/profile.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_error_reporter.h"
@@ -108,20 +106,12 @@ void ExtensionsService::Init() {
}
void ExtensionsService::InstallExtension(const FilePath& extension_path) {
- InstallExtension(extension_path, GURL(), GURL());
-}
-
-void ExtensionsService::InstallExtension(const FilePath& extension_path,
- const GURL& download_url,
- const GURL& referrer_url) {
- new CrxInstaller(extension_path, install_directory_, Extension::INTERNAL,
- "", // no expected id
- extensions_enabled_,
- IsDownloadFromGallery(download_url, referrer_url),
- show_extensions_prompts(),
- false, // don't delete crx when complete
- backend_loop_,
- this);
+ CrxInstaller::Start(extension_path, install_directory_, Extension::INTERNAL,
+ "", // no expected id
+ false, // don't delete crx when complete
+ backend_loop_,
+ this,
+ NULL); // no client (silent install)
}
void ExtensionsService::UpdateExtension(const std::string& id,
@@ -133,13 +123,12 @@ void ExtensionsService::UpdateExtension(const std::string& id,
return;
}
- new CrxInstaller(extension_path, install_directory_, Extension::INTERNAL,
- id, extensions_enabled_,
- false, // not from gallery
- show_extensions_prompts(),
- true, // delete crx when complete
- backend_loop_,
- this);
+ CrxInstaller::Start(extension_path, install_directory_, Extension::INTERNAL,
+ id,
+ true, // delete crx when complete
+ backend_loop_,
+ this,
+ NULL); // no client (silent install)
}
void ExtensionsService::ReloadExtension(const std::string& extension_id) {
@@ -312,7 +301,6 @@ void ExtensionsService::OnExtensionInstalled(Extension* extension) {
// If the extension is a theme, tell the profile (and therefore ThemeProvider)
// to apply it.
if (extension->IsTheme()) {
- ShowThemePreviewInfobar(extension);
NotificationService::current()->Notify(
NotificationType::THEME_INSTALLED,
Source<ExtensionsService>(this),
@@ -334,7 +322,6 @@ void ExtensionsService::OnExtensionInstalled(Extension* extension) {
void ExtensionsService::OnExtensionOverinstallAttempted(const std::string& id) {
Extension* extension = GetExtensionById(id);
if (extension && extension->IsTheme()) {
- ShowThemePreviewInfobar(extension);
NotificationService::current()->Notify(
NotificationType::THEME_INSTALLED,
Source<ExtensionsService>(this),
@@ -369,23 +356,6 @@ void ExtensionsService::SetProviderForTesting(
location, test_provider));
}
-bool ExtensionsService::ShowThemePreviewInfobar(Extension* extension) {
- if (!profile_)
- return false;
-
- Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
- if (!browser)
- return false;
-
- TabContents* tab_contents = browser->GetSelectedTabContents();
- if (!tab_contents)
- return false;
-
- tab_contents->AddInfoBar(new ThemePreviewInfobarDelegate(tab_contents,
- extension->name()));
- return true;
-}
-
void ExtensionsService::OnExternalExtensionFound(const std::string& id,
const std::string& version,
const FilePath& path,
@@ -410,12 +380,11 @@ void ExtensionsService::OnExternalExtensionFound(const std::string& id,
}
}
- new CrxInstaller(path, install_directory_, location, id, extensions_enabled_,
- false, // not from gallery
- show_extensions_prompts(),
- false, // don't delete crx when complete
- backend_loop_,
- this);
+ CrxInstaller::Start(path, install_directory_, location, id,
+ false, // don't delete crx when complete
+ backend_loop_,
+ this,
+ NULL); // no client (silent install)
}

Powered by Google App Engine
This is Rietveld 408576698