summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/download/download_manager.cc1
-rw-r--r--chrome/browser/extensions/crx_installer.cc34
-rw-r--r--chrome/browser/extensions/crx_installer.h63
-rw-r--r--chrome/browser/extensions/extension_browsertest.cc2
-rw-r--r--chrome/browser/extensions/extension_disabled_infobar_delegate.cc105
-rw-r--r--chrome/browser/extensions/extension_install_ui.cc12
-rw-r--r--chrome/browser/extensions/extension_install_ui.h43
-rw-r--r--chrome/browser/extensions/extensions_service.cc13
-rw-r--r--chrome/browser/views/extensions/extension_install_prompt.cc19
-rw-r--r--chrome/common/extensions/extension.cc8
-rw-r--r--chrome/common/extensions/extension.h5
-rw-r--r--chrome/common/notification_type.h3
12 files changed, 196 insertions, 112 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index da4ccd8..92a9885 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_file.h"
#include "chrome/browser/download/download_util.h"
+#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_install_ui.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/profile.h"
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index c6d4590..352cd8c 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -31,7 +31,7 @@ void CrxInstaller::Start(const FilePath& crx_path,
bool delete_crx,
MessageLoop* file_loop,
ExtensionsService* frontend,
- CrxInstallerClient* client) {
+ ExtensionInstallUI* client) {
// Note: We don't keep a reference because this object manages its own
// lifetime.
new CrxInstaller(crx_path, install_directory, install_source, expected_id,
@@ -45,7 +45,7 @@ CrxInstaller::CrxInstaller(const FilePath& crx_path,
bool delete_crx,
MessageLoop* file_loop,
ExtensionsService* frontend,
- CrxInstallerClient* client)
+ ExtensionInstallUI* client)
: crx_path_(crx_path),
install_directory_(install_directory),
install_source_(install_source),
@@ -116,23 +116,25 @@ void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir,
expected_id_.c_str()));
return;
}
- if (client_.get()) DecodeInstallIcon();
+ if (client_.get()) {
+ DecodeInstallIcon(extension_->GetIconPath(Extension::EXTENSION_ICON_LARGE),
+ &install_icon_);
+ }
ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
- &CrxInstaller::ConfirmInstall));
+ &CrxInstaller::ConfirmInstall));
}
-void CrxInstaller::DecodeInstallIcon() {
- std::map<int, std::string>::const_iterator iter =
- extension_->icons().find(128);
- if (iter == extension_->icons().end())
+// static
+void CrxInstaller::DecodeInstallIcon(const FilePath& large_icon_path,
+ scoped_ptr<SkBitmap>* result) {
+ if (large_icon_path.empty())
return;
- FilePath path = extension_->GetResourcePath(iter->second);
std::string file_contents;
- if (!file_util::ReadFileToString(path, &file_contents)) {
+ if (!file_util::ReadFileToString(large_icon_path, &file_contents)) {
LOG(ERROR) << "Could not read icon file: "
- << WideToUTF8(path.ToWStringHack());
+ << WideToUTF8(large_icon_path.ToWStringHack());
return;
}
@@ -144,7 +146,7 @@ void CrxInstaller::DecodeInstallIcon() {
*decoded = decoder.Decode(data, file_contents.length());
if (decoded->empty()) {
LOG(ERROR) << "Could not decode icon file: "
- << WideToUTF8(path.ToWStringHack());
+ << WideToUTF8(large_icon_path.ToWStringHack());
return;
}
@@ -155,7 +157,7 @@ void CrxInstaller::DecodeInstallIcon() {
return;
}
- install_icon_.reset(decoded.release());
+ result->swap(decoded);
}
void CrxInstaller::ConfirmInstall() {
@@ -163,13 +165,13 @@ void CrxInstaller::ConfirmInstall() {
if (frontend_->extension_prefs()->IsExtensionBlacklisted(extension_->id())) {
LOG(INFO) << "This extension: " << extension_->id()
<< " is blacklisted. Install failed.";
- if (client_) {
+ if (client_.get()) {
client_->OnInstallFailure("This extension is blacklisted.");
}
return;
}
- if (client_) {
+ if (client_.get()) {
AddRef(); // balanced in ContinueInstall() and AbortInstall().
client_->ConfirmInstall(this, extension_.get(), install_icon_.get());
} else {
@@ -250,7 +252,7 @@ void CrxInstaller::ReportFailureFromUIThread(const std::string& error) {
// rid of this line.
ExtensionErrorReporter::GetInstance()->ReportError(error, false); // quiet
- if (client_)
+ if (client_.get())
client_->OnInstallFailure(error);
}
diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h
index 0ea8398..d7ae504 100644
--- a/chrome/browser/extensions/crx_installer.h
+++ b/chrome/browser/extensions/crx_installer.h
@@ -10,44 +10,14 @@
#include "base/file_path.h"
#include "base/message_loop.h"
#include "base/ref_counted.h"
+#include "base/task.h"
+#include "chrome/browser/extensions/extension_install_ui.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
#include "chrome/common/extensions/extension.h"
-class CrxInstaller;
class SkBitmap;
-// Classes that want to know about install completion, or that want to have an
-// opportunity to reject the unpacked extension before installation, should
-// implement this interface.
-class CrxInstallerClient
- : public base::RefCountedThreadSafe<CrxInstallerClient> {
- public:
- virtual ~CrxInstallerClient() {}
-
- // This is called by the installer to verify whether the installation should
- // proceed. Clients can use this time to put up UI, or to do any checks they
- // need to on the unpacked extension.
- //
- // Clients *MUST* eventually call either ContinueInstall() or AbortInstall()
- // on |installer|.
- //
- // Clients should not AddRef() |installer|.
- virtual void ConfirmInstall(CrxInstaller* installer,
- Extension* extension,
- SkBitmap* icon) = 0;
-
- // Installation was successful.
- virtual void OnInstallSuccess(Extension* extension) = 0;
-
- // Intallation failed.
- virtual void OnInstallFailure(const std::string& error) = 0;
-
- // The install was rejected because the same extension/version is already
- // installed.
- virtual void OnOverinstallAttempted(Extension* extension) = 0;
-};
-
// This class installs a crx file into a profile.
//
// Installing a CRX is a multi-step process, including unpacking the crx,
@@ -65,7 +35,9 @@ class CrxInstallerClient
// long enough to receive the result of unpacking.
//
// TODO(aa): Pull out a frontend interface for testing?
-class CrxInstaller : public SandboxedExtensionUnpackerClient {
+class CrxInstaller :
+ public SandboxedExtensionUnpackerClient,
+ public ExtensionInstallUI::Delegate {
public:
// Starts the installation of the crx file in |crx_path| into
// |install_directory|.
@@ -89,15 +61,16 @@ class CrxInstaller : public SandboxedExtensionUnpackerClient {
bool delete_crx,
MessageLoop* file_loop,
ExtensionsService* frontend,
- CrxInstallerClient* client);
+ ExtensionInstallUI* client);
- // Clients should call this method after ConfirmInstall() if they want the
- // installation to continue.
- void ContinueInstall();
+ // Given the path to the large icon from an extension, read it if present and
+ // decode it into result.
+ static void DecodeInstallIcon(const FilePath& large_icon_path,
+ scoped_ptr<SkBitmap>* result);
- // Clients should call this method after ConfirmInstall() if they want the
- // installation to stop.
- void AbortInstall();
+ // ExtensionInstallUI::Delegate
+ virtual void ContinueInstall();
+ virtual void AbortInstall();
private:
CrxInstaller(const FilePath& crx_path,
@@ -107,7 +80,7 @@ class CrxInstaller : public SandboxedExtensionUnpackerClient {
bool delete_crx,
MessageLoop* file_loop,
ExtensionsService* frontend,
- CrxInstallerClient* client);
+ ExtensionInstallUI* client);
~CrxInstaller();
// SandboxedExtensionUnpackerClient
@@ -116,11 +89,7 @@ class CrxInstaller : public SandboxedExtensionUnpackerClient {
const FilePath& extension_dir,
Extension* extension);
- // Read the icon from the extension if present and decode it into
- // install_icon_.
- void DecodeInstallIcon();
-
- // Runs on the UI thread. Confirms with the user (via CrxInstallerClient) that
+ // Runs on the UI thread. Confirms with the user (via ExtensionInstallUI) that
// it is OK to install this extension.
void ConfirmInstall();
@@ -181,7 +150,7 @@ class CrxInstaller : public SandboxedExtensionUnpackerClient {
// The client we will work with to do the installation. This can be NULL, in
// which case the install is silent.
- scoped_refptr<CrxInstallerClient> client_;
+ scoped_ptr<ExtensionInstallUI> client_;
// The root of the unpacked extension directory. This is a subdirectory of
// temp_dir_, so we don't have to delete it explicitly.
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc
index a6c8624..d9f488c 100644
--- a/chrome/browser/extensions/extension_browsertest.cc
+++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -168,7 +168,7 @@ void ExtensionBrowserTest::Observe(NotificationType type,
break;
case NotificationType::EXTENSION_UPDATE_DISABLED:
- std::cout << "Got EXTENSIONS_DISABLED_LOAD notification.\n";
+ std::cout << "Got EXTENSION_UPDATE_DISABLED notification.\n";
MessageLoopForUI::current()->Quit();
break;
diff --git a/chrome/browser/extensions/extension_disabled_infobar_delegate.cc b/chrome/browser/extensions/extension_disabled_infobar_delegate.cc
index f812392..8dc323a 100644
--- a/chrome/browser/extensions/extension_disabled_infobar_delegate.cc
+++ b/chrome/browser/extensions/extension_disabled_infobar_delegate.cc
@@ -5,6 +5,9 @@
#include "chrome/browser/extensions/extension_disabled_infobar_delegate.h"
#include "app/l10n_util.h"
+#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/extensions/crx_installer.h"
+#include "chrome/browser/extensions/extension_install_ui.h"
#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -13,29 +16,82 @@
#include "chrome/common/notification_service.h"
#include "grit/generated_resources.h"
+class ExtensionDisabledDialogDelegate
+ : public ExtensionInstallUI::Delegate,
+ public base::RefCountedThreadSafe<ExtensionDisabledDialogDelegate> {
+ public:
+ ExtensionDisabledDialogDelegate(Profile* profile,
+ ExtensionsService* service,
+ Extension* extension)
+ : profile_(profile), service_(service), extension_(extension),
+ ui_loop_(MessageLoop::current()) {
+ AddRef(); // balanced in ContinueInstall or AbortInstall.
+
+ // Do this now because we can't touch extension on the file loop.
+ install_icon_path_ =
+ extension_->GetIconPath(Extension::EXTENSION_ICON_LARGE);
+
+ ChromeThread::GetMessageLoop(ChromeThread::FILE)->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &ExtensionDisabledDialogDelegate::Start));
+ }
+
+ // ExtensionInstallUI::Delegate
+ virtual void ContinueInstall() {
+ service_->EnableExtension(extension_->id());
+ Release();
+ }
+ virtual void AbortInstall() {
+ // Do nothing. The extension will remain disabled.
+ Release();
+ }
+
+ private:
+ void Start() {
+ // We start on the file thread so we can decode the install icon.
+ CrxInstaller::DecodeInstallIcon(install_icon_path_, &install_icon_);
+ // Then we display the UI on the UI thread.
+ ui_loop_->PostTask(FROM_HERE,
+ NewRunnableMethod(this,
+ &ExtensionDisabledDialogDelegate::ConfirmInstall));
+ }
+
+ void ConfirmInstall() {
+ DCHECK(MessageLoop::current() == ui_loop_);
+ ExtensionInstallUI ui(profile_);
+ ui.ConfirmInstall(this, extension_, install_icon_.get());
+ }
+
+ Profile* profile_;
+ ExtensionsService* service_;
+ Extension* extension_;
+ FilePath install_icon_path_;
+ scoped_ptr<SkBitmap> install_icon_;
+ MessageLoop* ui_loop_;
+};
+
class ExtensionDisabledInfobarDelegate
: public ConfirmInfoBarDelegate,
public NotificationObserver {
public:
ExtensionDisabledInfobarDelegate(TabContents* tab_contents,
ExtensionsService* service,
- const std::string& extension_id,
- const std::string& extension_name)
+ Extension* extension)
: ConfirmInfoBarDelegate(tab_contents),
tab_contents_(tab_contents),
service_(service),
- extension_id_(extension_id),
- extension_name_(extension_name) {
+ extension_(extension) {
// The user might re-enable the extension in other ways, so watch for that.
registrar_.Add(this, NotificationType::EXTENSIONS_LOADED,
Source<ExtensionsService>(service));
+ registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED,
+ Source<ExtensionsService>(service));
}
virtual void InfoBarClosed() {
delete this;
}
virtual std::wstring GetMessageText() const {
return l10n_util::GetStringF(IDS_EXTENSION_DISABLED_INFOBAR_LABEL,
- UTF8ToWide(extension_name_));
+ UTF8ToWide(extension_->name()));
}
virtual SkBitmap* GetIcon() const {
return NULL;
@@ -48,24 +104,34 @@ class ExtensionDisabledInfobarDelegate
return l10n_util::GetString(IDS_EXTENSION_DISABLED_INFOBAR_ENABLE_BUTTON);
}
virtual bool Accept() {
- service_->EnableExtension(extension_id_);
+ // This object manages its own lifetime.
+ new ExtensionDisabledDialogDelegate(tab_contents_->profile(),
+ service_, extension_);
return true;
}
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == NotificationType::EXTENSIONS_LOADED);
- ExtensionList* extensions = Details<ExtensionList>(details).ptr();
-
- for (ExtensionList::iterator iter = extensions->begin();
- iter != extensions->end(); ++iter) {
- if ((*iter)->id() == extension_id_) {
- // TODO(mpcomplete): This doesn't seem to always result in us getting
- // deleted.
- tab_contents_->RemoveInfoBar(this);
- return;
- }
+ // TODO(mpcomplete): RemoveInfoBar doesn't seem to always result in us
+ // getting deleted.
+ switch (type.value) {
+ case NotificationType::EXTENSIONS_LOADED: {
+ ExtensionList* extensions = Details<ExtensionList>(details).ptr();
+ ExtensionList::iterator iter = std::find(extensions->begin(),
+ extensions->end(), extension_);
+ if (iter != extensions->end())
+ tab_contents_->RemoveInfoBar(this);
+ break;
+ }
+ case NotificationType::EXTENSION_UNLOADED_DISABLED: {
+ Extension* extension = Details<Extension>(details).ptr();
+ if (extension == extension_)
+ tab_contents_->RemoveInfoBar(this);
+ break;
+ }
+ default:
+ NOTREACHED();
}
}
@@ -73,8 +139,7 @@ class ExtensionDisabledInfobarDelegate
NotificationRegistrar registrar_;
TabContents* tab_contents_;
ExtensionsService* service_;
- std::string extension_id_;
- std::string extension_name_;
+ Extension* extension_;
};
void ShowExtensionDisabledUI(ExtensionsService* service, Profile* profile,
@@ -88,5 +153,5 @@ void ShowExtensionDisabledUI(ExtensionsService* service, Profile* profile,
return;
tab_contents->AddInfoBar(new ExtensionDisabledInfobarDelegate(
- tab_contents, service, extension->id(), extension->name()));
+ tab_contents, service, extension));
}
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc
index a2c9258..2515b36 100644
--- a/chrome/browser/extensions/extension_install_ui.cc
+++ b/chrome/browser/extensions/extension_install_ui.cc
@@ -28,7 +28,7 @@ ExtensionInstallUI::ExtensionInstallUI(Profile* profile)
: profile_(profile), ui_loop_(MessageLoop::current()) {
}
-void ExtensionInstallUI::ConfirmInstall(CrxInstaller* installer,
+void ExtensionInstallUI::ConfirmInstall(Delegate* delegate,
Extension* extension,
SkBitmap* install_icon) {
DCHECK(ui_loop_ == MessageLoop::current());
@@ -42,12 +42,12 @@ void ExtensionInstallUI::ConfirmInstall(CrxInstaller* installer,
if (previous_theme)
previous_theme_id_ = previous_theme->id();
- installer->ContinueInstall();
+ delegate->ContinueInstall();
return;
}
#if defined(OS_WIN)
- ShowExtensionInstallPrompt(profile_, installer, extension, install_icon);
+ ShowExtensionInstallPrompt(profile_, delegate, extension, install_icon);
#elif defined(OS_MACOSX)
// TODO(port): Implement nicer UI.
@@ -63,14 +63,14 @@ void ExtensionInstallUI::ConfirmInstall(CrxInstaller* installer,
"This is a temporary message and it will be removed when "
"extensions UI is finalized."),
NULL, CFSTR("Cancel"), NULL, &response)) {
- installer->AbortInstall();
+ delegate->AbortInstall();
} else {
- installer->ContinueInstall();
+ delegate->ContinueInstall();
}
#else
// TODO(port): Implement some UI.
NOTREACHED();
- installer->ContinueInstall();
+ delegate->ContinueInstall();
#endif // OS_*
}
diff --git a/chrome/browser/extensions/extension_install_ui.h b/chrome/browser/extensions/extension_install_ui.h
index 6ca224d..1914989 100644
--- a/chrome/browser/extensions/extension_install_ui.h
+++ b/chrome/browser/extensions/extension_install_ui.h
@@ -8,32 +8,55 @@
#include "base/file_path.h"
#include "base/gfx/native_widget_types.h"
#include "base/ref_counted.h"
-#include "chrome/browser/extensions/crx_installer.h"
+class Extension;
class ExtensionsService;
class MessageLoop;
class Profile;
class SandboxedExtensionUnpacker;
+class SkBitmap;
// Displays all the UI around extension installation.
-class ExtensionInstallUI : public CrxInstallerClient {
+class ExtensionInstallUI {
public:
+ class Delegate {
+ public:
+ // We call this method after ConfirmInstall() to signal that the
+ // installation should continue.
+ virtual void ContinueInstall() = 0;
+
+ // We call this method after ConfirmInstall() to signal that the
+ // installation should stop.
+ virtual void AbortInstall() = 0;
+ };
+
// NOTE: The implementation of this is platform-specific.
static void ShowExtensionInstallPrompt(Profile* profile,
- CrxInstaller* installer,
+ Delegate* delegate,
Extension* extension,
SkBitmap* install_icon);
ExtensionInstallUI(Profile* profile);
- private:
- // CrxInstallerClient
- virtual void ConfirmInstall(CrxInstaller* installer, Extension* extension,
- SkBitmap* icon);
- virtual void OnInstallSuccess(Extension* extension);
- virtual void OnInstallFailure(const std::string& error);
- virtual void OnOverinstallAttempted(Extension* extension);
+ // This is called by the installer to verify whether the installation should
+ // proceed.
+ //
+ // We *MUST* eventually call either ContinueInstall() or AbortInstall()
+ // on |delegate|.
+ void ConfirmInstall(Delegate* delegate, Extension* extension,
+ SkBitmap* icon);
+
+ // Installation was successful.
+ void OnInstallSuccess(Extension* extension);
+ // Intallation failed.
+ void OnInstallFailure(const std::string& error);
+
+ // The install was rejected because the same extension/version is already
+ // installed.
+ void OnOverinstallAttempted(Extension* extension);
+
+ private:
void ShowThemeInfoBar(Extension* new_theme);
Profile* profile_;
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index f70d7cf..89ef1fc 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -246,8 +246,11 @@ void ExtensionsService::UnloadExtension(const std::string& extension_id) {
disabled_extensions_.end(),
extension.get());
if (iter != disabled_extensions_.end()) {
- // It's disabled, so don't send the unload notification.
disabled_extensions_.erase(iter);
+ NotificationService::current()->Notify(
+ NotificationType::EXTENSION_UNLOADED_DISABLED,
+ Source<ExtensionsService>(this),
+ Details<Extension>(extension.get()));
return;
}
@@ -313,7 +316,7 @@ void ExtensionsService::OnExtensionsLoaded(ExtensionList* new_extensions) {
extension->IsTheme() ||
extension->location() == Extension::LOAD ||
Extension::IsExternalLocation(extension->location())) {
- Extension* old = GetExtensionById(extension->id());
+ Extension* old = GetExtensionByIdInternal(extension->id(), true, true);
if (old) {
if (extension->version()->CompareTo(*(old->version())) > 0) {
bool higher_permissions =
@@ -374,7 +377,11 @@ void ExtensionsService::OnExtensionsLoaded(ExtensionList* new_extensions) {
}
void ExtensionsService::OnExtensionInstalled(Extension* extension) {
- extension_prefs_->OnExtensionInstalled(extension);
+ // Make sure we don't enable a disabled extension.
+ if (extension_prefs_->GetExtensionState(extension->id()) !=
+ Extension::DISABLED) {
+ extension_prefs_->OnExtensionInstalled(extension);
+ }
// If the extension is a theme, tell the profile (and therefore ThemeProvider)
// to apply it.
diff --git a/chrome/browser/views/extensions/extension_install_prompt.cc b/chrome/browser/views/extensions/extension_install_prompt.cc
index e110464..6c58914 100644
--- a/chrome/browser/views/extensions/extension_install_prompt.cc
+++ b/chrome/browser/views/extensions/extension_install_prompt.cc
@@ -35,9 +35,10 @@ const int kRightColumnWidth = 290;
// We could have a collection of funny descriptions for each color.
class InstallDialogContent : public views::View, public views::DialogDelegate {
public:
- InstallDialogContent(CrxInstaller* crx_installer, Extension* extension,
+ InstallDialogContent(ExtensionInstallUI::Delegate* delegate,
+ Extension* extension,
SkBitmap* icon)
- : crx_installer_(crx_installer), icon_(NULL) {
+ : delegate_(delegate), icon_(NULL) {
if (icon) {
icon_ = new views::ImageView();
icon_->SetImage(*icon);
@@ -93,12 +94,12 @@ class InstallDialogContent : public views::View, public views::DialogDelegate {
}
virtual bool Accept() {
- crx_installer_->ContinueInstall();
+ delegate_->ContinueInstall();
return true;
}
virtual bool Cancel() {
- crx_installer_->AbortInstall();
+ delegate_->AbortInstall();
return true;
}
@@ -162,7 +163,7 @@ class InstallDialogContent : public views::View, public views::DialogDelegate {
y += severe_->height();
}
- scoped_refptr<CrxInstaller> crx_installer_;
+ ExtensionInstallUI::Delegate* delegate_;
views::ImageView* icon_;
views::Label* heading_;
views::Label* warning_;
@@ -174,21 +175,21 @@ class InstallDialogContent : public views::View, public views::DialogDelegate {
} // namespace
void ExtensionInstallUI::ShowExtensionInstallPrompt(Profile* profile,
- CrxInstaller* crx_installer,
+ Delegate* delegate,
Extension* extension,
SkBitmap* icon) {
Browser* browser = BrowserList::GetLastActiveWithProfile(profile);
if (!browser) {
- crx_installer->AbortInstall();
+ delegate->ContinueInstall();
return;
}
BrowserWindow* window = browser->window();
if (!window) {
- crx_installer->AbortInstall();
+ delegate->AbortInstall();
return;
}
views::Window::CreateChromeWindow(window->GetNativeHandle(), gfx::Rect(),
- new InstallDialogContent(crx_installer, extension, icon))->Show();
+ new InstallDialogContent(delegate, extension, icon))->Show();
}
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index ebb8d13..08b77bb 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1003,3 +1003,11 @@ void Extension::SetBackgroundPageReady() {
Source<Extension>(this),
NotificationService::NoDetails());
}
+
+FilePath Extension::GetIconPath(Icons icon) {
+ std::map<int, std::string>::const_iterator iter =
+ icons_.find(Extension::EXTENSION_ICON_LARGE);
+ if (iter == icons_.end())
+ return FilePath();
+ return GetResourcePath(iter->second);
+}
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index b9761d0..afd62c1 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -223,8 +223,13 @@ class Extension {
// the browser might load (like themes and page action icons).
std::set<FilePath> GetBrowserImages();
+ // Calculates and returns the permission class this extension is in.
PermissionClass GetPermissionClass();
+ // Returns an absolute path to the given icon inside of the extension. Returns
+ // an empty FilePath if the extension does not have that icon.
+ FilePath GetIconPath(Icons icon);
+
// Runtime data:
// Put dynamic data about the state of a running extension below.
diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h
index ed37cc6..8d98578 100644
--- a/chrome/common/notification_type.h
+++ b/chrome/common/notification_type.h
@@ -620,6 +620,9 @@ class NotificationType {
// state.
EXTENSION_UNLOADED,
+ // Same as above, but for a disabled extension.
+ EXTENSION_UNLOADED_DISABLED,
+
// Sent after a new ExtensionHost is created. The details are
// an ExtensionHost* and the source is an ExtensionProcessManager*.
EXTENSION_HOST_CREATED,