summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-09 23:03:47 +0000
committerasargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-09 23:03:47 +0000
commit9609a928dc9855920abf3306a12b214be62cca82 (patch)
treed738ad4c883a618c75197a6ea4ad555edfcd636f
parent9f6b93f96c1c4ee38b55864f3a97c157f091aea6 (diff)
downloadchromium_src-9609a928dc9855920abf3306a12b214be62cca82.zip
chromium_src-9609a928dc9855920abf3306a12b214be62cca82.tar.gz
chromium_src-9609a928dc9855920abf3306a12b214be62cca82.tar.bz2
Merge 88204 - Partially deprecate the old webstorePrivate.beginInstall method
We are still allowing it to be used to do installs, but with this change it will no longer prevent the confirmation dialog from appearing. Once the web store completely transitions to use the newer beginInstallWithManifest2 method, we can remove beginInstall alltogether. BUG=75821 TEST=Installing an app/extension from the web store should cause an install confirmation prompt to appear after the item downloads. Review URL: http://codereview.chromium.org/7131001 TBR=asargent@chromium.org Review URL: http://codereview.chromium.org/7003100 git-svn-id: svn://svn.chromium.org/chrome/branches/782/src@88606 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/crx_installer.cc7
-rw-r--r--chrome/browser/extensions/crx_installer_browsertest.cc7
-rw-r--r--chrome/browser/extensions/extension_gallery_install_apitest.cc38
-rw-r--r--chrome/browser/extensions/extension_install_ui.h2
4 files changed, 47 insertions, 7 deletions
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index 86a7f39..e772a0f 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -392,11 +392,10 @@ void CrxInstaller::ConfirmInstall() {
current_version_ =
frontend_weak_->extension_prefs()->GetVersionString(extension_->id());
- // First see if it's whitelisted by id (the old mechanism).
- bool whitelisted = ClearWhitelistedInstallId(extension_->id()) &&
- extension_->plugins().empty() && is_gallery_install_;
+ // TODO(asargent) - remove this when we fully deprecate the old install api.
+ ClearWhitelistedInstallId(extension_->id());
- // Now check if there's a WhitelistEntry.
+ bool whitelisted = false;
scoped_ptr<CrxInstaller::WhitelistEntry> entry(
RemoveWhitelistEntry(extension_->id()));
if (is_gallery_install_ && entry.get() && original_manifest_.get()) {
diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc
index fec9564..15cec56 100644
--- a/chrome/browser/extensions/crx_installer_browsertest.cc
+++ b/chrome/browser/extensions/crx_installer_browsertest.cc
@@ -67,9 +67,10 @@ class ExtensionCrxInstallerTest : public ExtensionBrowserTest {
};
IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, Whitelisting) {
- // A regular extension should give no prompt.
- EXPECT_FALSE(DidWhitelistInstallPrompt("good.crx",
- "ldnnhddmnhbkjipkidpdiheffobcpfmf"));
+ // We're deprecating this whitelist mechanism, but right now we just assert
+ // that it actually did prompt.
+ EXPECT_TRUE(DidWhitelistInstallPrompt("good.crx",
+ "ldnnhddmnhbkjipkidpdiheffobcpfmf"));
#if !defined(OS_CHROMEOS)
// An extension with NPAPI should give a prompt.
EXPECT_TRUE(DidWhitelistInstallPrompt("uitest/plugins.crx",
diff --git a/chrome/browser/extensions/extension_gallery_install_apitest.cc b/chrome/browser/extensions/extension_gallery_install_apitest.cc
index 309f4f5..2a0b8be 100644
--- a/chrome/browser/extensions/extension_gallery_install_apitest.cc
+++ b/chrome/browser/extensions/extension_gallery_install_apitest.cc
@@ -11,8 +11,44 @@
#include "chrome/browser/extensions/extension_webstore_private_api.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/ui_test_utils.h"
+#include "content/common/notification_observer.h"
+#include "content/common/notification_registrar.h"
+#include "content/common/notification_service.h"
+#include "content/common/notification_type.h"
#include "net/base/mock_host_resolver.h"
+// This is a helper class to let us automatically accept extension install
+// dialogs.
+class GalleryInstallApiTestObserver :
+ public base::RefCounted<GalleryInstallApiTestObserver>,
+ public NotificationObserver {
+ public:
+ GalleryInstallApiTestObserver() {
+ registrar_.Add(this,
+ NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG,
+ NotificationService::AllSources());
+ }
+
+ void InstallUIProceed(ExtensionInstallUI::Delegate* delegate) {
+ delegate->InstallUIProceed();
+ }
+
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) OVERRIDE {
+ ExtensionInstallUI* prompt = Source<ExtensionInstallUI>(source).ptr();
+ CHECK(prompt->delegate_);
+ MessageLoop::current()->PostTask(
+ FROM_HERE, NewRunnableMethod(
+ this,
+ &GalleryInstallApiTestObserver::InstallUIProceed,
+ prompt->delegate_));
+ }
+
+ private:
+ NotificationRegistrar registrar_;
+};
+
class ExtensionGalleryInstallApiTest : public ExtensionApiTest {
public:
void SetUpCommandLine(CommandLine* command_line) {
@@ -22,6 +58,8 @@ class ExtensionGalleryInstallApiTest : public ExtensionApiTest {
}
bool RunInstallTest(const std::string& page) {
+ scoped_refptr<GalleryInstallApiTestObserver> observer =
+ new GalleryInstallApiTestObserver(); // Responds to install dialog.
std::string base_url = base::StringPrintf(
"http://www.example.com:%u/files/extensions/",
test_server()->host_port_pair().port());
diff --git a/chrome/browser/extensions/extension_install_ui.h b/chrome/browser/extensions/extension_install_ui.h
index 44e2f26..3348158 100644
--- a/chrome/browser/extensions/extension_install_ui.h
+++ b/chrome/browser/extensions/extension_install_ui.h
@@ -82,6 +82,8 @@ class ExtensionInstallUI : public ImageLoadingTracker::Observer {
static void DisableFailureUIForTests();
private:
+ friend class GalleryInstallApiTestObserver;
+
// Show an infobar for a newly-installed theme. previous_theme_id
// should be empty if the previous theme was the system/default
// theme.