summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 20:25:49 +0000
committermihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-17 20:25:49 +0000
commit6824c9f3070117dd340b60add331155ecb487e02 (patch)
tree7b6e13732a7c6c09b9fc3bd1d2c0e21527ff25d6 /chrome
parent5edc18ad4b7b374500d3e9f3df19c3643a23dc9d (diff)
downloadchromium_src-6824c9f3070117dd340b60add331155ecb487e02.zip
chromium_src-6824c9f3070117dd340b60add331155ecb487e02.tar.gz
chromium_src-6824c9f3070117dd340b60add331155ecb487e02.tar.bz2
Add webstorePrivate.beginInstallWithManifest3 and remove webstorePrivate.beginInstall.
beginInstallWithManifest3 is a superset of beginInstallWithManifest2 with the following changes: - Don't require a user gesture (there's a prompt already, and the gesture requirement is preventing the webstore from lazily loading manifest data). - Allow additional properties in the object parameter that's passed in. We had issues where we added the iconUrl param in M15, but the store couldn't pass it to M14 builds since they barfed on unknown properties. Also removes the old beginInstall method, since the store always uses beginInstallWithManifest2 now. BUG=100242,100240 R=mpcomplete@chromium.org Review URL: http://codereview.chromium.org/8271020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105899 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/crx_installer.h4
-rw-r--r--chrome/browser/extensions/crx_installer_browsertest.cc4
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.cc1
-rw-r--r--chrome/browser/extensions/extension_gallery_install_apitest.cc123
-rw-r--r--chrome/browser/extensions/extension_webstore_private_api.cc55
-rw-r--r--chrome/browser/extensions/extension_webstore_private_api.h23
-rw-r--r--chrome/browser/extensions/extension_webstore_private_apitest.cc6
-rw-r--r--chrome/chrome_tests.gypi1
-rw-r--r--chrome/common/extensions/api/extension_api.json52
-rw-r--r--chrome/renderer/resources/extensions/extension_process_bindings.js13
-rw-r--r--chrome/test/data/extensions/api_test/extension_gallery_install/common.js20
-rw-r--r--chrome/test/data/extensions/api_test/extension_gallery_install/complete_without_begin.html11
-rw-r--r--chrome/test/data/extensions/api_test/extension_gallery_install/invalid_begin.html8
-rw-r--r--chrome/test/data/extensions/api_test/extension_gallery_install/no_user_gesture.html10
-rw-r--r--chrome/test/data/extensions/api_test/extension_gallery_install/test.html25
-rw-r--r--chrome/test/data/extensions/api_test/webstore_private/accepted.js12
-rw-r--r--chrome/test/data/extensions/api_test/webstore_private/app_install_bubble.js2
-rw-r--r--chrome/test/data/extensions/api_test/webstore_private/cancelled.html15
-rw-r--r--chrome/test/data/extensions/api_test/webstore_private/icon_url.js4
-rw-r--r--chrome/test/data/extensions/api_test/webstore_private/incorrect_manifest.js2
-rw-r--r--chrome/test/data/extensions/api_test/webstore_private/localized.js2
-rw-r--r--chrome/test/data/extensions/api_test/webstore_private/no_user_gesture.html11
22 files changed, 56 insertions, 348 deletions
diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h
index ce6bcfb..995e850 100644
--- a/chrome/browser/extensions/crx_installer.h
+++ b/chrome/browser/extensions/crx_installer.h
@@ -54,6 +54,8 @@ class CrxInstaller
// *by the web store only* which should not get the permissions install
// prompt. This should only be called on the UI thread.
// crbug.com/54916
+ // TODO(asargent): This should be removed now that SetWhitelistEntry exists
+ // http://crbug.com/100584
static void SetWhitelistedInstallId(const std::string& id);
struct WhitelistEntry {
@@ -70,7 +72,7 @@ class CrxInstaller
// Exempt the next extension install with |id| from displaying a confirmation
// prompt, since the user already agreed to the install via
- // beginInstallWithManifest. We require that the extension manifest matches
+ // beginInstallWithManifest3. We require that the extension manifest matches
// the manifest in |entry|, which is what was used to prompt with. Ownership
// of |entry| is transferred here.
static void SetWhitelistEntry(const std::string& id, WhitelistEntry* entry);
diff --git a/chrome/browser/extensions/crx_installer_browsertest.cc b/chrome/browser/extensions/crx_installer_browsertest.cc
index 96052f1..9353aa1 100644
--- a/chrome/browser/extensions/crx_installer_browsertest.cc
+++ b/chrome/browser/extensions/crx_installer_browsertest.cc
@@ -67,10 +67,6 @@ class ExtensionCrxInstallerTest : public ExtensionBrowserTest {
};
IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, Whitelisting) {
- // 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_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index 46d4676..bb263fb 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -356,7 +356,6 @@ void FactoryRegistry::ResetFunctions() {
RegisterFunction<GetBrowserLoginFunction>();
RegisterFunction<GetStoreLoginFunction>();
RegisterFunction<SetStoreLoginFunction>();
- RegisterFunction<BeginInstallFunction>();
RegisterFunction<BeginInstallWithManifestFunction>();
RegisterFunction<CompleteInstallFunction>();
diff --git a/chrome/browser/extensions/extension_gallery_install_apitest.cc b/chrome/browser/extensions/extension_gallery_install_apitest.cc
deleted file mode 100644
index bf3a580..0000000
--- a/chrome/browser/extensions/extension_gallery_install_apitest.cc
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/stringprintf.h"
-#if defined (OS_WIN)
-#include "base/win/windows_version.h"
-#endif // defined (OS_WIN)
-
-#include "chrome/browser/extensions/extension_apitest.h"
-#include "chrome/browser/extensions/extension_webstore_private_api.h"
-#include "chrome/common/chrome_notification_types.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/test/base/ui_test_utils.h"
-#include "content/common/notification_observer.h"
-#include "content/common/notification_registrar.h"
-#include "content/common/notification_service.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,
- chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG,
- NotificationService::AllSources());
- }
-
- void InstallUIProceed(ExtensionInstallUI::Delegate* delegate) {
- delegate->InstallUIProceed();
- }
-
- virtual void Observe(int 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) {
- ExtensionApiTest::SetUpCommandLine(command_line);
- command_line->AppendSwitchASCII(switches::kAppsGalleryURL,
- "http://www.example.com");
- }
-
- 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());
-
- std::string testing_install_base_url = base_url;
- testing_install_base_url += "good.crx";
-
- CommandLine::ForCurrentProcess()->AppendSwitchASCII(
- switches::kAppsGalleryUpdateURL, testing_install_base_url);
-
- std::string page_url = base_url;
- page_url += "api_test/extension_gallery_install/" + page;
-
- return RunPageTest(page_url.c_str());
- }
-};
-
-namespace {
-
-bool RunningOnXP() {
-#if defined (OS_WIN)
- return GetVersion() < base::win::VERSION_VISTA;
-#else
- return false;
-#endif // defined (OS_WIN)
-}
-
-} // namespace
-
-// TODO(asargent) - for some reason this test occasionally fails on XP,
-// but not other versions of windows. http://crbug.com/55642
-#if defined (OS_WIN)
-#define MAYBE_InstallAndUninstall DISABLED_InstallAndUninstall
-#else
-#define MAYBE_InstallAndUninstall InstallAndUninstall
-#endif
-IN_PROC_BROWSER_TEST_F(ExtensionGalleryInstallApiTest,
- MAYBE_InstallAndUninstall) {
- if (RunningOnXP()) {
- LOG(INFO) << "Adding host resolver rule";
- }
- host_resolver()->AddRule("www.example.com", "127.0.0.1");
- if (RunningOnXP()) {
- LOG(INFO) << "Starting test server";
- }
- ASSERT_TRUE(test_server()->Start());
-
- if (RunningOnXP()) {
- LOG(INFO) << "Starting tests without user gesture checking";
- }
- BeginInstallFunction::SetIgnoreUserGestureForTests(true);
- ASSERT_TRUE(RunInstallTest("test.html"));
- ASSERT_TRUE(RunInstallTest("complete_without_begin.html"));
- ASSERT_TRUE(RunInstallTest("invalid_begin.html"));
-
- if (RunningOnXP()) {
- LOG(INFO) << "Starting tests with user gesture checking";
- }
- BeginInstallFunction::SetIgnoreUserGestureForTests(false);
- ASSERT_TRUE(RunInstallTest("no_user_gesture.html"));
-}
diff --git a/chrome/browser/extensions/extension_webstore_private_api.cc b/chrome/browser/extensions/extension_webstore_private_api.cc
index 151b044..74039b3 100644
--- a/chrome/browser/extensions/extension_webstore_private_api.cc
+++ b/chrome/browser/extensions/extension_webstore_private_api.cc
@@ -48,14 +48,11 @@ const char kCannotSpecifyIconDataAndUrlError[] =
const char kInvalidIconUrlError[] = "Invalid icon url";
const char kInvalidIdError[] = "Invalid id";
const char kInvalidManifestError[] = "Invalid manifest";
-const char kNoPreviousBeginInstallError[] =
- "* does not match a previous call to beginInstall";
+const char kNoPreviousBeginInstallWithManifestError[] =
+ "* does not match a previous call to beginInstallWithManifest3";
const char kUserCancelledError[] = "User cancelled install";
-const char kUserGestureRequiredError[] =
- "This function must be called during a user gesture";
ProfileSyncService* test_sync_service = NULL;
-bool ignore_user_gesture_for_tests = false;
// Returns either the test sync service, or the real one from |profile|.
ProfileSyncService* GetSyncService(Profile* profile) {
@@ -111,34 +108,6 @@ void WebstorePrivateApi::SetWebstoreInstallerDelegateForTesting(
test_webstore_installer_delegate = delegate;
}
-// static
-void BeginInstallFunction::SetIgnoreUserGestureForTests(bool ignore) {
- ignore_user_gesture_for_tests = ignore;
-}
-
-bool BeginInstallFunction::RunImpl() {
- if (!IsWebStoreURL(profile_, source_url()))
- return false;
-
- std::string id;
- EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &id));
- if (!Extension::IdIsValid(id)) {
- error_ = kInvalidIdError;
- return false;
- }
-
- if (!user_gesture() && !ignore_user_gesture_for_tests) {
- error_ = kUserGestureRequiredError;
- return false;
- }
-
- // This gets cleared in CrxInstaller::ConfirmInstall(). TODO(asargent) - in
- // the future we may also want to add time-based expiration, where a whitelist
- // entry is only valid for some number of minutes.
- CrxInstaller::SetWhitelistedInstallId(id);
- return true;
-}
-
BeginInstallWithManifestFunction::BeginInstallWithManifestFunction()
: use_app_installed_bubble_(false) {}
@@ -150,12 +119,6 @@ bool BeginInstallWithManifestFunction::RunImpl() {
return false;
}
- if (!user_gesture() && !ignore_user_gesture_for_tests) {
- SetResult(NO_GESTURE);
- error_ = kUserGestureRequiredError;
- return false;
- }
-
DictionaryValue* details = NULL;
EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details));
CHECK(details);
@@ -241,9 +204,6 @@ void BeginInstallWithManifestFunction::SetResult(ResultCode code) {
case PERMISSION_DENIED:
result_.reset(Value::CreateStringValue("permission_denied"));
break;
- case NO_GESTURE:
- result_.reset(Value::CreateStringValue("no_gesture"));
- break;
case INVALID_ICON_URL:
result_.reset(Value::CreateStringValue("invalid_icon_url"));
break;
@@ -252,12 +212,6 @@ void BeginInstallWithManifestFunction::SetResult(ResultCode code) {
}
}
-// static
-void BeginInstallWithManifestFunction::SetIgnoreUserGestureForTests(
- bool ignore) {
- ignore_user_gesture_for_tests = ignore;
-}
-
void BeginInstallWithManifestFunction::OnWebstoreParseSuccess(
const SkBitmap& icon, DictionaryValue* parsed_manifest) {
CHECK(parsed_manifest);
@@ -309,6 +263,9 @@ void BeginInstallWithManifestFunction::OnWebstoreParseFailure(
}
void BeginInstallWithManifestFunction::InstallUIProceed() {
+ // This gets cleared in CrxInstaller::ConfirmInstall(). TODO(asargent) - in
+ // the future we may also want to add time-based expiration, where a whitelist
+ // entry is only valid for some number of minutes.
CrxInstaller::WhitelistEntry* entry = new CrxInstaller::WhitelistEntry;
entry->parsed_manifest.reset(parsed_manifest_.release());
entry->localized_name = localized_name_;
@@ -365,7 +322,7 @@ bool CompleteInstallFunction::RunImpl() {
if (!CrxInstaller::IsIdWhitelisted(id) &&
!CrxInstaller::GetWhitelistEntry(id)) {
error_ = ExtensionErrorUtils::FormatErrorMessage(
- kNoPreviousBeginInstallError, id);
+ kNoPreviousBeginInstallWithManifestError, id);
return false;
}
diff --git a/chrome/browser/extensions/extension_webstore_private_api.h b/chrome/browser/extensions/extension_webstore_private_api.h
index 23d8914b..1200603 100644
--- a/chrome/browser/extensions/extension_webstore_private_api.h
+++ b/chrome/browser/extensions/extension_webstore_private_api.h
@@ -29,18 +29,6 @@ class WebstorePrivateApi {
WebstoreInstaller::Delegate* delegate);
};
-// TODO(asargent): this is being deprecated in favor of
-// BeginInstallWithManifestFunction. See crbug.com/75821 for details.
-class BeginInstallFunction : public SyncExtensionFunction {
- public:
- // For use only in tests - sets a flag that can cause this function to ignore
- // the normal requirement that it is called during a user gesture.
- static void SetIgnoreUserGestureForTests(bool ignore);
- protected:
- virtual bool RunImpl();
- DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstall");
-};
-
class BeginInstallWithManifestFunction
: public AsyncExtensionFunction,
public ExtensionInstallUI::Delegate,
@@ -49,7 +37,7 @@ class BeginInstallWithManifestFunction
BeginInstallWithManifestFunction();
// Result codes for the return value. If you change this, make sure to
- // update the description for the beginInstallWithManifest callback in
+ // update the description for the beginInstallWithManifest3 callback in
// extension_api.json.
enum ResultCode {
ERROR_NONE = 0,
@@ -72,17 +60,10 @@ class BeginInstallWithManifestFunction
// The page does not have permission to call this function.
PERMISSION_DENIED,
- // The function was not called during a user gesture.
- NO_GESTURE,
-
// Invalid icon url.
INVALID_ICON_URL
};
- // For use only in tests - sets a flag that can cause this function to ignore
- // the normal requirement that it is called during a user gesture.
- static void SetIgnoreUserGestureForTests(bool ignore);
-
// Implementing WebstoreInstallHelper::Delegate interface.
virtual void OnWebstoreParseSuccess(
const SkBitmap& icon,
@@ -118,7 +99,7 @@ class BeginInstallWithManifestFunction
// ExtensionInstallUI to prompt for confirmation of the install.
scoped_refptr<Extension> dummy_extension_;
- DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstallWithManifest2");
+ DECLARE_EXTENSION_FUNCTION_NAME("webstorePrivate.beginInstallWithManifest3");
};
class CompleteInstallFunction : public SyncExtensionFunction {
diff --git a/chrome/browser/extensions/extension_webstore_private_apitest.cc b/chrome/browser/extensions/extension_webstore_private_apitest.cc
index e668902..1190560 100644
--- a/chrome/browser/extensions/extension_webstore_private_apitest.cc
+++ b/chrome/browser/extensions/extension_webstore_private_apitest.cc
@@ -90,7 +90,6 @@ class ExtensionWebstorePrivateApiTest : public ExtensionApiTest {
// API functions.
host_resolver()->AddRule("www.example.com", "127.0.0.1");
ASSERT_TRUE(test_server()->Start());
- BeginInstallWithManifestFunction::SetIgnoreUserGestureForTests(true);
SetExtensionInstallDialogForManifestAutoConfirmForTests(true);
ExtensionInstallUI::DisableFailureUIForTests();
}
@@ -143,11 +142,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallCancelled) {
ASSERT_TRUE(RunInstallTest("cancelled.html", "extension.crx"));
}
-IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallNoGesture) {
- BeginInstallFunction::SetIgnoreUserGestureForTests(false);
- ASSERT_TRUE(RunInstallTest("no_user_gesture.html", "extension.crx"));
-}
-
IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest,
IncorrectManifest1) {
WebstoreInstallListener listener;
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index c67411c..44a6c56 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -2381,7 +2381,6 @@
'browser/extensions/extension_fileapi_apitest.cc',
'browser/extensions/extension_function_test_utils.cc',
'browser/extensions/extension_function_test_utils.h',
- 'browser/extensions/extension_gallery_install_apitest.cc',
'browser/extensions/extension_geolocation_apitest.cc',
'browser/extensions/extension_get_views_apitest.cc',
'browser/extensions/extension_history_apitest.cc',
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index c0af639..08a5ee8 100644
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -777,21 +777,21 @@
"description": "The speech options.",
"properties": {
"enqueue": {
- "type": "boolean",
- "optional": true,
- "description": "If true, enqueues this utterance if TTS is already in progress. If false (the default), interrupts any current speech and flushes the speech queue before speaking this new utterance."
+ "type": "boolean",
+ "optional": true,
+ "description": "If true, enqueues this utterance if TTS is already in progress. If false (the default), interrupts any current speech and flushes the speech queue before speaking this new utterance."
},
- "voiceName": {
+ "voiceName": {
"type": "string",
"optional": true,
"description": "The name of the voice to use for synthesis. If empty, uses any available voice."
},
- "extensionId": {
+ "extensionId": {
"type": "string",
"optional": true,
"description": "The extension ID of the speech engine to use, if known."
},
- "lang": {
+ "lang": {
"type": "string",
"optional": true,
"description": "The language to be used for synthesis, in the form <em>language</em>-<em>region</em>. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'."
@@ -957,12 +957,12 @@
"name": "options",
"description": "Options specified to the tts.speak() method.",
"properties": {
- "voiceName": {
+ "voiceName": {
"type": "string",
"optional": true,
"description": "The name of the voice to use for synthesis."
},
- "lang": {
+ "lang": {
"type": "string",
"optional": true,
"description": "The language to be used for synthesis, in the form <em>language</em>-<em>region</em>. Examples: 'en', 'en-US', 'en-GB', 'zh-CN'."
@@ -995,7 +995,7 @@
"description": "Speaking volume between 0 and 1 inclusive, with 0 being lowest and 1 being highest, with a default of 1.0."
}
}
- },
+ },
{
"name": "sendTtsEvent",
"type": "function",
@@ -1247,7 +1247,7 @@
"top": {"type": "integer", "optional": true, "description": "The number of pixels to position the new window from the top edge of the screen. If not specified, the new window is offset naturally from the last focusd window. This value is ignored for panels."},
"width": {"type": "integer", "minimum": 0, "optional": true, "description": "The width in pixels of the new window. If not specified defaults to a natural width."},
"height": {"type": "integer", "minimum": 0, "optional": true, "description": "The height in pixels of the new window. If not specified defaults to a natural height."},
- "focused": {"type": "boolean", "optional": true, "description": "If true, opens an active window. If false, opens an inactive window."},
+ "focused": {"type": "boolean", "optional": true, "description": "If true, opens an active window. If false, opens an inactive window."},
"incognito": {"type": "boolean", "optional": true, "description": "Whether the new window should be an incognito window."},
"type": {
"type": "string",
@@ -7810,25 +7810,8 @@
]
},
{
- "name": "beginInstall",
- "description": "Initiates the install process for the given extension id",
- "parameters": [
- {
- "name": "expected_id",
- "type": "string",
- "description": "The id of the extension to be installled. Must be called during a user gesture."
- },
- {
- "name": "callback",
- "type": "function",
- "optional": "true",
- "parameters": []
- }
- ]
- },
- {
- "name": "beginInstallWithManifest2",
- "description": "Initiates the install process for the given extension. This must be called during a user gesture.",
+ "name": "beginInstallWithManifest3",
+ "description": "Initiates the install process for the given extension.",
"parameters": [
{
"name": "details",
@@ -7870,7 +7853,8 @@
"optional": true,
"description": "A flag to change the UI we show when an app is installed - a value of true means to show a bubble pointing at the new tab button (instead of the default behavior of opening the new tab page and animating the app icon)."
}
- }
+ },
+ "additionalProperties": { "type": "any" }
},
{
"name": "callback",
@@ -7881,7 +7865,7 @@
{
"name": "result",
"type": "string",
- "description": "A string result code, which will be empty upon success. The possible values in the case of errors include 'unknown_error', 'user_cancelled', 'manifest_error', 'icon_error', 'invalid_id', 'permission_denied', 'no_gesture', and 'invalid_icon_url'."
+ "description": "A string result code, which will be empty upon success. The possible values in the case of errors include 'unknown_error', 'user_cancelled', 'manifest_error', 'icon_error', 'invalid_id', 'permission_denied', and 'invalid_icon_url'."
}
]
}
@@ -7895,7 +7879,7 @@
{
"name": "expected_id",
"type": "string",
- "description": "The id of the extension to be installled. This should match a previous call to beginInstall."
+ "description": "The id of the extension to be installled. This should match a previous call to beginInstallWithManifest3."
},
{
"name": "callback",
@@ -8987,13 +8971,13 @@
"type": "function",
"description": "Called when the MHTML has been generated.",
"parameters": [
- {
+ {
"name": "mhtmlData",
"type": "blob",
"optional": "true",
"description": "The MHTML data as a Blob."
}
- ]
+ ]
}
]
}
diff --git a/chrome/renderer/resources/extensions/extension_process_bindings.js b/chrome/renderer/resources/extensions/extension_process_bindings.js
index 5ada917..0d4745d 100644
--- a/chrome/renderer/resources/extensions/extension_process_bindings.js
+++ b/chrome/renderer/resources/extensions/extension_process_bindings.js
@@ -705,12 +705,17 @@ var chrome = chrome || {};
}
addProperties(module, apiDef);
-
- // getTabContentses is retained for backwards compatibility
- // See http://crbug.com/21433
- chrome.extension.getTabContentses = chrome.extension.getExtensionTabs;
});
+ // getTabContentses is retained for backwards compatibility
+ // See http://crbug.com/21433
+ chrome.extension.getTabContentses = chrome.extension.getExtensionTabs;
+ // TOOD(mihaip): remove this alias once the webstore stops calling
+ // beginInstallWithManifest2.
+ // See http://crbug.com/100242
+ chrome.webstorePrivate.beginInstallWithManifest2 =
+ chrome.webstorePrivate.beginInstallWithManifest3;
+
apiFunctions["tabs.connect"].handleRequest = function(tabId, connectInfo) {
var name = "";
if (connectInfo) {
diff --git a/chrome/test/data/extensions/api_test/extension_gallery_install/common.js b/chrome/test/data/extensions/api_test/extension_gallery_install/common.js
deleted file mode 100644
index c9d1687..0000000
--- a/chrome/test/data/extensions/api_test/extension_gallery_install/common.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-var extension_id = "ldnnhddmnhbkjipkidpdiheffobcpfmf";
-
-var assertEq = chrome.test.assertEq;
-var assertNoLastError = chrome.test.assertNoLastError;
-var succeed = chrome.test.succeed;
-
-// Calls |callback| with true/false indicating whether an item with an id of
-// extension_id is installed.
-function checkInstalled(callback) {
- chrome.management.getAll(function(extensions) {
- var found = false;
- callback(extensions.some(function(ext) {
- return ext.id == extension_id;
- }));
- });
-}
diff --git a/chrome/test/data/extensions/api_test/extension_gallery_install/complete_without_begin.html b/chrome/test/data/extensions/api_test/extension_gallery_install/complete_without_begin.html
deleted file mode 100644
index 1907619..0000000
--- a/chrome/test/data/extensions/api_test/extension_gallery_install/complete_without_begin.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<script src="common.js"></script>
-<script>
-// This tests that a call to completeInstall without a previous call to begin
-// generates an error.
-chrome.webstorePrivate.completeInstall(extension_id, function() {
- var expected_error = extension_id +
- " does not match a previous call to beginInstall";
- chrome.test.assertEq(chrome.extension.lastError.message, expected_error);
- chrome.test.succeed();
-});
-</script>
diff --git a/chrome/test/data/extensions/api_test/extension_gallery_install/invalid_begin.html b/chrome/test/data/extensions/api_test/extension_gallery_install/invalid_begin.html
deleted file mode 100644
index 7c2d5d7..0000000
--- a/chrome/test/data/extensions/api_test/extension_gallery_install/invalid_begin.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<script src="common.js"></script>
-<script>
-// This tests that an invalid id passed to beginInstall generates an error.
-chrome.webstorePrivate.beginInstall("some invalid id", function() {
- assertEq(chrome.extension.lastError.message, "Invalid id");
- succeed();
-});
-</script>
diff --git a/chrome/test/data/extensions/api_test/extension_gallery_install/no_user_gesture.html b/chrome/test/data/extensions/api_test/extension_gallery_install/no_user_gesture.html
deleted file mode 100644
index 4aa5714..0000000
--- a/chrome/test/data/extensions/api_test/extension_gallery_install/no_user_gesture.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<script src="common.js"></script>
-<script>
-// We expect that this test is called outside of a user gesture, which should
-// generate an error.
-chrome.webstorePrivate.beginInstall(extension_id, function() {
- assertEq(chrome.extension.lastError.message,
- "This function must be called during a user gesture");
- succeed();
-});
-</script>
diff --git a/chrome/test/data/extensions/api_test/extension_gallery_install/test.html b/chrome/test/data/extensions/api_test/extension_gallery_install/test.html
deleted file mode 100644
index b3ced6e..0000000
--- a/chrome/test/data/extensions/api_test/extension_gallery_install/test.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<script src="common.js"></script>
-<script>
-// This tests the webstorePrivate beginInstall and completeInstall functions.
-
-// Register a listener for when the install is completed.
-chrome.management.onInstalled.addListener(function(info) {
- assertEq(info.id, extension_id);
- succeed();
-});
-
-// Make sure our extension isn't yet installed.
-checkInstalled(function(installed) {
- assertEq(false, installed);
-
- // Begin installing.
- chrome.webstorePrivate.beginInstall(extension_id, function() {
- assertNoLastError();
-
- // Now complete the installation.
- chrome.webstorePrivate.completeInstall(extension_id, function() {
- assertNoLastError();
- });
- });
-});
-</script>
diff --git a/chrome/test/data/extensions/api_test/webstore_private/accepted.js b/chrome/test/data/extensions/api_test/webstore_private/accepted.js
index f750305..1eea8b6 100644
--- a/chrome/test/data/extensions/api_test/webstore_private/accepted.js
+++ b/chrome/test/data/extensions/api_test/webstore_private/accepted.js
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Tests where the beginInstallWithManifest2 dialog would be auto-accepted
+// Tests where the beginInstallWithManifest3 dialog would be auto-accepted
// (including a few cases where this does not matter).
var tests = [
function completeBeforeBegin() {
- var expectedError =
- extensionId + " does not match a previous call to beginInstall";
+ var expectedError = extensionId +
+ " does not match a previous call to beginInstallWithManifest3";
chrome.webstorePrivate.completeInstall(extensionId,
callbackFail(expectedError));
},
@@ -17,7 +17,7 @@ var tests = [
function invalidID() {
var expectedError = "Invalid id";
var id = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
- chrome.webstorePrivate.beginInstallWithManifest2(
+ chrome.webstorePrivate.beginInstallWithManifest3(
{ 'id':id, 'manifest':getManifest() }, callbackFail(expectedError));
},
@@ -25,7 +25,7 @@ var tests = [
var manifestObj = JSON.parse(getManifest());
delete manifestObj["version"];
var manifest = JSON.stringify(manifestObj);
- chrome.webstorePrivate.beginInstallWithManifest2(
+ chrome.webstorePrivate.beginInstallWithManifest3(
{ 'id':extensionId, 'manifest': manifest },
callbackFail("Invalid manifest", function(result) {
assertEq("manifest_error", result);
@@ -42,7 +42,7 @@ var tests = [
getIconData(function(icon) {
// Begin installing.
- chrome.webstorePrivate.beginInstallWithManifest2(
+ chrome.webstorePrivate.beginInstallWithManifest3(
{'id': extensionId,'iconData': icon, 'manifest': manifest },
function(result) {
assertNoLastError();
diff --git a/chrome/test/data/extensions/api_test/webstore_private/app_install_bubble.js b/chrome/test/data/extensions/api_test/webstore_private/app_install_bubble.js
index 05727b1..cc5610f 100644
--- a/chrome/test/data/extensions/api_test/webstore_private/app_install_bubble.js
+++ b/chrome/test/data/extensions/api_test/webstore_private/app_install_bubble.js
@@ -11,7 +11,7 @@ var tests = [
var manifest = getManifest("app/manifest.json");
// Begin installing.
- chrome.webstorePrivate.beginInstallWithManifest2(
+ chrome.webstorePrivate.beginInstallWithManifest3(
{'id': appId,'manifest': manifest, 'appInstallBubble':true},
callbackPass(function(result) {
assertEq(result, "");
diff --git a/chrome/test/data/extensions/api_test/webstore_private/cancelled.html b/chrome/test/data/extensions/api_test/webstore_private/cancelled.html
index 91ebf6c..643b93f 100644
--- a/chrome/test/data/extensions/api_test/webstore_private/cancelled.html
+++ b/chrome/test/data/extensions/api_test/webstore_private/cancelled.html
@@ -1,18 +1,17 @@
<script src="common.js"></script>
<script>
// This tests the user cancelling an install started by
-// beginInstallWithManifest2.
+// beginInstallWithManifest3.
var manifest = getManifest();
getIconData(function(icon) {
// Begin installing.
- chrome.webstorePrivate.beginInstallWithManifest2({ 'id':extensionId,
- 'iconData': icon,
- 'manifest': manifest },
- function(result) {
- assertEq(result, "user_cancelled");
- succeed();
- });
+ chrome.webstorePrivate.beginInstallWithManifest3(
+ {'id':extensionId, 'iconData': icon, 'manifest': manifest},
+ function(result) {
+ assertEq(result, "user_cancelled");
+ succeed();
+ });
});
</script>
diff --git a/chrome/test/data/extensions/api_test/webstore_private/icon_url.js b/chrome/test/data/extensions/api_test/webstore_private/icon_url.js
index e87a1a9b..0b86916 100644
--- a/chrome/test/data/extensions/api_test/webstore_private/icon_url.js
+++ b/chrome/test/data/extensions/api_test/webstore_private/icon_url.js
@@ -13,7 +13,7 @@ var tests = [
function IconUrlFailure() {
var manifest = getManifest();
var loadFailureUrl = makeAbsoluteUrl("does_not_exist.png");
- chrome.webstorePrivate.beginInstallWithManifest2(
+ chrome.webstorePrivate.beginInstallWithManifest3(
{'id': extensionId,'iconUrl': loadFailureUrl, 'manifest': manifest },
callbackFail("Image decode failed", function(result) {
assertEq(result, "icon_error");
@@ -28,7 +28,7 @@ var tests = [
function runSuccessTest(absoluteIconUrl) {
var iconPath = "extension/icon.png";
var iconUrl = absoluteIconUrl ? makeAbsoluteUrl(iconPath) : iconPath;
- chrome.webstorePrivate.beginInstallWithManifest2(
+ chrome.webstorePrivate.beginInstallWithManifest3(
{'id': extensionId,'iconUrl': iconUrl, 'manifest': manifest },
callbackPass());
}
diff --git a/chrome/test/data/extensions/api_test/webstore_private/incorrect_manifest.js b/chrome/test/data/extensions/api_test/webstore_private/incorrect_manifest.js
index 752d3ef..a08a689 100644
--- a/chrome/test/data/extensions/api_test/webstore_private/incorrect_manifest.js
+++ b/chrome/test/data/extensions/api_test/webstore_private/incorrect_manifest.js
@@ -11,7 +11,7 @@ var manifest = alterManifest(manifestObj);
// that we get an install error after unpacking the crx file because the crx
// file's manifest won't match what we provided for the confirmation dialog
// here.
-chrome.webstorePrivate.beginInstallWithManifest2(
+chrome.webstorePrivate.beginInstallWithManifest3(
{ 'id': extensionId, 'manifest': manifest },
function(result) {
assertNoLastError();
diff --git a/chrome/test/data/extensions/api_test/webstore_private/localized.js b/chrome/test/data/extensions/api_test/webstore_private/localized.js
index 3165032..2e93e47 100644
--- a/chrome/test/data/extensions/api_test/webstore_private/localized.js
+++ b/chrome/test/data/extensions/api_test/webstore_private/localized.js
@@ -18,7 +18,7 @@ var tests = [
var messages = getManifest('localized_extension/_locales/fr/messages.json');
getIconData(function(icon) {
// Begin installing.
- chrome.webstorePrivate.beginInstallWithManifest2(
+ chrome.webstorePrivate.beginInstallWithManifest3(
{ 'id':localizedId, 'iconData': icon, 'manifest': manifest,
'localizedName': 'Le Title', 'locale': 'fr' },
callbackPass(function(result) {
diff --git a/chrome/test/data/extensions/api_test/webstore_private/no_user_gesture.html b/chrome/test/data/extensions/api_test/webstore_private/no_user_gesture.html
deleted file mode 100644
index 876ff5f..0000000
--- a/chrome/test/data/extensions/api_test/webstore_private/no_user_gesture.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<script src="common.js"></script>
-<script>
-// We expect that this test is called outside of a user gesture, which should
-// generate an error.
-chrome.webstorePrivate.beginInstallWithManifest2(
- { 'id':extensionId, 'manifest': getManifest() }, function() {
- assertEq(chrome.extension.lastError.message,
- "This function must be called during a user gesture");
- succeed();
-});
-</script>