summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/crx_installer.cc
diff options
context:
space:
mode:
authorlzheng@chromium.org <lzheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-14 06:37:18 +0000
committerlzheng@chromium.org <lzheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-14 06:37:18 +0000
commit6b75ec3c19f7a05c9104ee4b1edf2074af88d5b9 (patch)
treec992c8e6606b6a7cf52e3e2427dd1a4d33c24e0a /chrome/browser/extensions/crx_installer.cc
parent7b291f9c1394495724ddd81306e982e840075c08 (diff)
downloadchromium_src-6b75ec3c19f7a05c9104ee4b1edf2074af88d5b9.zip
chromium_src-6b75ec3c19f7a05c9104ee4b1edf2074af88d5b9.tar.gz
chromium_src-6b75ec3c19f7a05c9104ee4b1edf2074af88d5b9.tar.bz2
The change has the followings:
1. Auto-updating of extension blacklist. 2. Handle extensions in the blacklist. If an extension is in the blacklist, a. browser will not load the extension at start time; b. browser will unload the extension at running time; c. browser will not install the extension; BUG=12118 TEST=Verify behavior described above works (they should be covered in the unittests in this change). Review URL: http://codereview.chromium.org/165164 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23423 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/crx_installer.cc')
-rw-r--r--chrome/browser/extensions/crx_installer.cc31
1 files changed, 21 insertions, 10 deletions
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index 5fede2e..c6d4590 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -116,14 +116,10 @@ void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir,
expected_id_.c_str()));
return;
}
+ if (client_.get()) DecodeInstallIcon();
- if (client_.get()) {
- DecodeInstallIcon();
- ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
- &CrxInstaller::ConfirmInstall));
- } else {
- CompleteInstall();
- }
+ ui_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
+ &CrxInstaller::ConfirmInstall));
}
void CrxInstaller::DecodeInstallIcon() {
@@ -146,7 +142,7 @@ void CrxInstaller::DecodeInstallIcon() {
webkit_glue::ImageDecoder decoder;
scoped_ptr<SkBitmap> decoded(new SkBitmap());
*decoded = decoder.Decode(data, file_contents.length());
- if(decoded->empty()) {
+ if (decoded->empty()) {
LOG(ERROR) << "Could not decode icon file: "
<< WideToUTF8(path.ToWStringHack());
return;
@@ -163,9 +159,24 @@ void CrxInstaller::DecodeInstallIcon() {
}
void CrxInstaller::ConfirmInstall() {
- AddRef(); // balanced in ContinueInstall() and AbortInstall().
+ DCHECK(MessageLoop::current() == ui_loop_);
+ if (frontend_->extension_prefs()->IsExtensionBlacklisted(extension_->id())) {
+ LOG(INFO) << "This extension: " << extension_->id()
+ << " is blacklisted. Install failed.";
+ if (client_) {
+ client_->OnInstallFailure("This extension is blacklisted.");
+ }
+ return;
+ }
- client_->ConfirmInstall(this, extension_.get(), install_icon_.get());
+ if (client_) {
+ AddRef(); // balanced in ContinueInstall() and AbortInstall().
+ client_->ConfirmInstall(this, extension_.get(), install_icon_.get());
+ } else {
+ file_loop_->PostTask(FROM_HERE, NewRunnableMethod(this,
+ &CrxInstaller::CompleteInstall));
+ }
+ return;
}
void CrxInstaller::ContinueInstall() {