summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/extensions')
-rw-r--r--chrome/common/extensions/api/bluetooth.idl2
-rw-r--r--chrome/common/extensions/api/context_menus.json4
-rw-r--r--chrome/common/extensions/api/cookies.json4
-rw-r--r--chrome/common/extensions/api/extension.json190
-rw-r--r--chrome/common/extensions/api/extension_api_unittest.cc6
-rw-r--r--chrome/common/extensions/api/file_browser_private.json4
-rw-r--r--chrome/common/extensions/api/input_ime.json6
-rw-r--r--chrome/common/extensions/api/tts.json2
-rw-r--r--chrome/common/extensions/api/webstore_private.json2
-rw-r--r--chrome/common/extensions/docs/examples/api/debugger/live-headers/background.js4
-rw-r--r--chrome/common/extensions/docs/examples/api/debugger/pause-resume/background.js4
-rw-r--r--chrome/common/extensions/docs/examples/api/devtools/audits/broken-links/devtools.js2
-rw-r--r--chrome/common/extensions/docs/examples/api/eventPage/basic/background.js2
-rw-r--r--chrome/common/extensions/docs/examples/api/eventPage/basic/content.js8
-rw-r--r--chrome/common/extensions/docs/examples/api/infobars/sandwichbar/contentscript.js11
-rw-r--r--chrome/common/extensions/docs/examples/api/messaging/timer/page.js6
-rw-r--r--chrome/common/extensions/docs/examples/api/speechInput/basic/background.js4
-rw-r--r--chrome/common/extensions/docs/examples/api/storage/stylizr/popup.js2
-rw-r--r--chrome/common/extensions/docs/examples/extensions/benchmark/background.js2
-rw-r--r--chrome/common/extensions/docs/examples/extensions/benchmark/script.js6
-rw-r--r--chrome/common/extensions/docs/examples/extensions/catifier/event_page.js8
-rw-r--r--chrome/common/extensions/docs/examples/extensions/email_this_page/background.js2
-rw-r--r--chrome/common/extensions/docs/examples/extensions/email_this_page/content_script.js10
-rw-r--r--chrome/common/extensions/docs/examples/extensions/native_messaging/popup.js2
-rw-r--r--chrome/common/extensions/docs/examples/extensions/plugin_settings/js/chrome_stubs.js4
-rw-r--r--chrome/common/extensions/docs/examples/extensions/plugin_settings/js/main.js4
-rw-r--r--chrome/common/extensions/docs/examples/extensions/plugin_settings/js/plugin_settings.js10
-rw-r--r--chrome/common/extensions/docs/examples/extensions/proxy_configuration/proxy_form_controller.js4
-rw-r--r--chrome/common/extensions/docs/examples/extensions/talking_alarm_clock/background.js2
-rw-r--r--chrome/common/extensions/docs/examples/extensions/talking_alarm_clock/popup.js2
-rw-r--r--chrome/common/extensions/docs/examples/extensions/ttsdemo/ttsdemo.js4
-rw-r--r--chrome/common/extensions/docs/templates/articles/content_scripts.html2
-rw-r--r--chrome/common/extensions/docs/templates/articles/manifestVersion.html2
-rw-r--r--chrome/common/extensions/docs/templates/articles/whats_new.html2
-rw-r--r--chrome/common/extensions/docs/templates/intros/experimental_speechInput.html12
-rw-r--r--chrome/common/extensions/docs/templates/intros/privacy.html10
-rw-r--r--chrome/common/extensions/docs/templates/intros/tts.html6
37 files changed, 86 insertions, 271 deletions
diff --git a/chrome/common/extensions/api/bluetooth.idl b/chrome/common/extensions/api/bluetooth.idl
index cbc4414..3c200a5 100644
--- a/chrome/common/extensions/api/bluetooth.idl
+++ b/chrome/common/extensions/api/bluetooth.idl
@@ -156,7 +156,7 @@ namespace bluetooth {
DeviceCallback deviceCallback;
};
- // These functions all report failures via chrome.extension.lastError.
+ // These functions all report failures via chrome.runtime.lastError.
interface Functions {
// Get information about the Bluetooth adapter.
// |callback| : Called with an AdapterState object describing the adapter
diff --git a/chrome/common/extensions/api/context_menus.json b/chrome/common/extensions/api/context_menus.json
index c4113ea..5f37e87 100644
--- a/chrome/common/extensions/api/context_menus.json
+++ b/chrome/common/extensions/api/context_menus.json
@@ -78,7 +78,7 @@
{
"name": "create",
"type": "function",
- "description": "Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in chrome.extension.lastError).",
+ "description": "Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in chrome.runtime.lastError).",
"returns": {
"choices": [
{ "type": "integer" },
@@ -170,7 +170,7 @@
"type": "function",
"name": "callback",
"optional": true,
- "description": "Called when the item has been created in the browser. If there were any problems creating the item, details will be available in chrome.extension.lastError.",
+ "description": "Called when the item has been created in the browser. If there were any problems creating the item, details will be available in chrome.runtime.lastError.",
"parameters": []
}
]
diff --git a/chrome/common/extensions/api/cookies.json b/chrome/common/extensions/api/cookies.json
index fd3a633..fc3e53f 100644
--- a/chrome/common/extensions/api/cookies.json
+++ b/chrome/common/extensions/api/cookies.json
@@ -118,7 +118,7 @@
"min_version": "11.0.674.0",
"parameters": [
{
- "name": "cookie", "$ref": "Cookie", "optional": true, "description": "Contains details about the cookie that's been set. If setting failed for any reason, this will be \"null\", and \"chrome.extension.lastError\" will be set."
+ "name": "cookie", "$ref": "Cookie", "optional": true, "description": "Contains details about the cookie that's been set. If setting failed for any reason, this will be \"null\", and \"chrome.runtime.lastError\" will be set."
}
]
}
@@ -148,7 +148,7 @@
{
"name": "details",
"type": "object",
- "description": "Contains details about the cookie that's been removed. If removal failed for any reason, this will be \"null\", and \"chrome.extension.lastError\" will be set.",
+ "description": "Contains details about the cookie that's been removed. If removal failed for any reason, this will be \"null\", and \"chrome.runtime.lastError\" will be set.",
"optional": true,
"properties": {
"url": {"type": "string", "description": "The URL associated with the cookie that's been removed."},
diff --git a/chrome/common/extensions/api/extension.json b/chrome/common/extensions/api/extension.json
index aa21140..ed97595 100644
--- a/chrome/common/extensions/api/extension.json
+++ b/chrome/common/extensions/api/extension.json
@@ -16,24 +16,6 @@
"tab": {"$ref": "tabs.Tab", "optional": true, "description":"This property will <b>only</b> be present when the connection was opened from a tab or content script."},
"id": {"type": "string", "description": "The extension ID of the extension that opened the connection."}
}
- },
- {
- "id": "Port",
- "nodoc": true,
- "type": "object",
- "description": "(Deprecated - use runtime.Port instead) An object which allows two way communication with other pages.",
- "properties": {
- "name": {"type": "string"},
- "onDisconnect": { "$ref": "events.Event" },
- "onMessage": { "$ref": "events.Event" },
- "postMessage": {"type": "function"},
- "sender": {
- "$ref": "MessageSender",
- "optional": true,
- "description": "This property will <b>only</b> be present on ports passed to onConnect/onConnectExternal listeners."
- }
- },
- "additionalProperties": { "type": "any"}
}
],
"properties": {
@@ -55,55 +37,6 @@
},
"functions": [
{
- "name": "connect",
- "nodoc": true,
- "nocompile": true,
- "type": "function",
- "unprivileged": true,
- "description": "(Deprecated - use runtime.connect) Attempts to connect to other listeners within the extension (such as the extension's background page). This is primarily useful for content scripts connecting to their extension processes. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via $ref:tabs.connect.",
- "parameters": [
- {"type": "string", "name": "extensionId", "optional": true, "description": "The extension ID of the extension you want to connect to. If omitted, default is your own extension."},
- {
- "type": "object",
- "name": "connectInfo",
- "properties": {
- "name": { "type": "string", "optional": true, "description": "Will be passed into onConnect for extension processes that are listening for the connection event." }
- },
- "optional": true
- }
- ],
- "returns": {
- "$ref": "Port",
- "description": "Port through which messages can be sent and received with the extension. The port's $ref:extension.Port event is fired if extension does not exist. "
- }
- },
- {
- "name": "connectNative",
- "nodoc": true,
- "nocompile": true,
- "type": "function",
- "description": "(Deprecated - use runtime.connectNative instead) Attempts to connect a native application in the host machine. The native application must have already registered itself in the proper directory.",
- "parameters": [
- {
- "type": "string",
- "name": "appName",
- "description": "The name of the registered app to connect to."
- },
- {
- "name": "connectionMessage",
- "description": "The object that will be passed to the registered native app on connection.",
- "type": "object",
- "additionalProperties": {
- "type": "any"
- }
- }
- ],
- "returns": {
- "$ref": "Port",
- "description": "Port through which messages can be sent and received with the application"
- }
- },
- {
"name": "sendRequest",
"nodoc": true,
"type": "function",
@@ -128,69 +61,6 @@
]
},
{
- "name": "sendMessage",
- "nodoc": true,
- "nocompile": true,
- "type": "function",
- "allowAmbiguousOptionalArguments": true,
- "unprivileged": true,
- "description": "Sends a single message to other listeners within the extension. Similar to chrome.extension.connect, but only sends a single message with an optional response. The $ref:extension.onMessage event is fired in each extension page of the extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use $ref:tabs.sendMessage.",
- "parameters": [
- {"type": "string", "name": "extensionId", "optional": true, "description": "The extension ID of the extension you want to connect to. If omitted, default is your own extension."},
- { "type": "any", "name": "message" },
- {
- "type": "function",
- "name": "responseCallback",
- "optional": true,
- "parameters": [
- {
- "name": "response",
- "type": "any",
- "description": "The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and $ref:runtime.lastError will be set to the error message."
- }
- ]
- }
- ]
- },
- {
- "name": "sendNativeMessage",
- "nodoc": true,
- "nocompile": true,
- "type": "function",
- "description": "(Deprecated - use runtime.sendNativeMessage) Send a single message to a registered native application.",
- "parameters": [
- {
- "name": "registeredNativeApp",
- "description": "The name of the registered native application.",
- "type": "string"
- },
- {
- "name": "message",
- "description": "The message that will be passed to the registered native application.",
- "type": "object",
- "additionalProperties": {
- "type": "any"
- }
- },
- {
- "type": "function",
- "name": "callback",
- "optional": true,
- "description": "Called with the response from the native application.",
- "parameters": [
- {
- "name": "nativeResponse",
- "type": "object",
- "description": "Whatever the native application responds with.",
- "additionalProperties": {
- "type": "any"
- }
- }
- ]
- }
- ]
- },
- {
"name": "getURL",
"type": "function",
"unprivileged": true,
@@ -310,29 +180,6 @@
],
"events": [
{
- "name": "onConnect",
- "nodoc": true,
- "nocompile": true,
- "type": "function",
- "unprivileged": true,
- "anonymous": true,
- "description": "Fired when a connection is made from either an extension process or a content script.",
- "parameters": [
- {"$ref": "Port", "name": "port"}
- ]
- },
- {
- "name": "onConnectExternal",
- "nodoc": true,
- "nocompile": true,
- "type": "function",
- "anonymous": true,
- "description": "Fired when a connection is made from another extension.",
- "parameters": [
- {"$ref": "Port", "name": "port"}
- ]
- },
- {
"name": "onRequest",
"nodoc": true,
"type": "function",
@@ -356,43 +203,6 @@
{"name": "sender", "$ref": "MessageSender" },
{"name": "sendResponse", "type": "function", "description": "Function to call when you have a response. The argument should be any JSON-ifiable object, or undefined if there is no response." }
]
- },
- {
- "name": "onMessage",
- "nodoc": true,
- "nocompile": true,
- "type": "function",
- "anonymous": true,
- "unprivileged": true,
- "description": "(Deprecated - use runtime.onMessage instead) Fired when a message is sent from either an extension process or a content script.",
- "parameters": [
- {"name": "message", "type": "any", "description": "The message sent by the calling script."},
- {"name": "sender", "$ref": "MessageSender" },
- {"name": "sendResponse", "type": "function", "description": "Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one <code>onMessage</code> listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until <code>sendResponse</code> is called)." }
- ],
- "returns": {
- "type": "boolean",
- "optional": "true",
- "description": "Return true from the event listener if you wish to call <code>sendResponse</code> after the event listener returns."
- }
- },
- {
- "name": "onMessageExternal",
- "nodoc": true,
- "nocompile": true,
- "type": "function",
- "anonymous": true,
- "description": "(Deprecated - use runtime.onMessageExternal instead) Fired when a message is sent from another extension. Cannot be used in a content script.",
- "parameters": [
- {"name": "message", "type": "any", "description": "The message sent by the calling script."},
- {"name": "sender", "$ref": "MessageSender" },
- {"name": "sendResponse", "type": "function", "description": "Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one <code>onMessage</code> listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until <code>sendResponse</code> is called)." }
- ],
- "returns": {
- "type": "boolean",
- "optional": "true",
- "description": "Return true from the event listener if you wish to call <code>sendResponse</code> after the event listener returns."
- }
}
]
}
diff --git a/chrome/common/extensions/api/extension_api_unittest.cc b/chrome/common/extensions/api/extension_api_unittest.cc
index 18146e4..106656c 100644
--- a/chrome/common/extensions/api/extension_api_unittest.cc
+++ b/chrome/common/extensions/api/extension_api_unittest.cc
@@ -97,11 +97,11 @@ TEST(ExtensionAPI, IsPrivileged) {
scoped_ptr<ExtensionAPI> extension_api(
ExtensionAPI::CreateWithDefaultConfiguration());
- EXPECT_FALSE(extension_api->IsPrivileged("extension.connect"));
- EXPECT_FALSE(extension_api->IsPrivileged("extension.onConnect"));
+ EXPECT_FALSE(extension_api->IsPrivileged("runtime.connect"));
+ EXPECT_FALSE(extension_api->IsPrivileged("runtime.onConnect"));
// Properties are not supported yet.
- EXPECT_TRUE(extension_api->IsPrivileged("extension.lastError"));
+ EXPECT_TRUE(extension_api->IsPrivileged("runtime.lastError"));
// Default unknown names to privileged for paranoia's sake.
EXPECT_TRUE(extension_api->IsPrivileged(""));
diff --git a/chrome/common/extensions/api/file_browser_private.json b/chrome/common/extensions/api/file_browser_private.json
index e5b15ef..087224e 100644
--- a/chrome/common/extensions/api/file_browser_private.json
+++ b/chrome/common/extensions/api/file_browser_private.json
@@ -837,7 +837,7 @@
"name": "callback",
"type": "function",
"optional": true,
- "description": "Completion callback. chrome.extension.lastError will be set if there was an error.",
+ "description": "Completion callback. chrome.runtime.lastError will be set if there was an error.",
"parameters": []
}
]
@@ -884,7 +884,7 @@
"name": "callback",
"type": "function",
"optional": true,
- "description": "Completion callback. chrome.extension.lastError will be set if there was an error.",
+ "description": "Completion callback. chrome.runtime.lastError will be set if there was an error.",
"parameters": []
}
]
diff --git a/chrome/common/extensions/api/input_ime.json b/chrome/common/extensions/api/input_ime.json
index ae99ab5..939408b 100644
--- a/chrome/common/extensions/api/input_ime.json
+++ b/chrome/common/extensions/api/input_ime.json
@@ -91,7 +91,7 @@
"type": "function",
"name": "callback",
"optional": true,
- "description": "Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.extension.lastError is set.",
+ "description": "Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set.",
"parameters": [
{
"name": "success",
@@ -120,7 +120,7 @@
"type": "function",
"name": "callback",
"optional": true,
- "description": "Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.extension.lastError is set.",
+ "description": "Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set.",
"parameters": [
{
"name": "success",
@@ -153,7 +153,7 @@
"type": "function",
"name": "callback",
"optional": true,
- "description": "Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.extension.lastError is set.",
+ "description": "Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set.",
"parameters": [
{
"name": "success",
diff --git a/chrome/common/extensions/api/tts.json b/chrome/common/extensions/api/tts.json
index 601edbf..3b2abf2 100644
--- a/chrome/common/extensions/api/tts.json
+++ b/chrome/common/extensions/api/tts.json
@@ -169,7 +169,7 @@
"type": "function",
"name": "callback",
"optional": true,
- "description": "Called right away, before speech finishes. Check chrome.extension.lastError to make sure there were no errors. Use options.onEvent to get more detailed feedback.",
+ "description": "Called right away, before speech finishes. Check chrome.runtime.lastError to make sure there were no errors. Use options.onEvent to get more detailed feedback.",
"parameters": []
}
]
diff --git a/chrome/common/extensions/api/webstore_private.json b/chrome/common/extensions/api/webstore_private.json
index c128edc..49e10e4 100644
--- a/chrome/common/extensions/api/webstore_private.json
+++ b/chrome/common/extensions/api/webstore_private.json
@@ -56,7 +56,7 @@
{
"name": "callback",
"type": "function",
- "description": "Called when the install process completes. Upon failures, chrome.extension.lastError will be set to 'user_canceled' or 'unknown_error'.",
+ "description": "Called when the install process completes. Upon failures, chrome.runtime.lastError will be set to 'user_canceled' or 'unknown_error'.",
"optional": "true",
"parameters": []
}
diff --git a/chrome/common/extensions/docs/examples/api/debugger/live-headers/background.js b/chrome/common/extensions/docs/examples/api/debugger/live-headers/background.js
index ad6595d..bba6065 100644
--- a/chrome/common/extensions/docs/examples/api/debugger/live-headers/background.js
+++ b/chrome/common/extensions/docs/examples/api/debugger/live-headers/background.js
@@ -15,8 +15,8 @@ function actionClicked(tab) {
}
function onAttach(tabId) {
- if (chrome.extension.lastError) {
- alert(chrome.extension.lastError.message);
+ if (chrome.runtime.lastError) {
+ alert(chrome.runtime.lastError.message);
return;
}
diff --git a/chrome/common/extensions/docs/examples/api/debugger/pause-resume/background.js b/chrome/common/extensions/docs/examples/api/debugger/pause-resume/background.js
index fb14127..3d6b032 100644
--- a/chrome/common/extensions/docs/examples/api/debugger/pause-resume/background.js
+++ b/chrome/common/extensions/docs/examples/api/debugger/pause-resume/background.js
@@ -28,8 +28,8 @@ function actionClicked(tab) {
}
function onAttach(debuggeeId) {
- if (chrome.extension.lastError) {
- alert(chrome.extension.lastError.message);
+ if (chrome.runtime.lastError) {
+ alert(chrome.runtime.lastError.message);
return;
}
diff --git a/chrome/common/extensions/docs/examples/api/devtools/audits/broken-links/devtools.js b/chrome/common/extensions/docs/examples/api/devtools/audits/broken-links/devtools.js
index bc406c9..5696dcd 100644
--- a/chrome/common/extensions/docs/examples/api/devtools/audits/broken-links/devtools.js
+++ b/chrome/common/extensions/docs/examples/api/devtools/audits/broken-links/devtools.js
@@ -27,4 +27,4 @@ category.onAuditStarted.addListener(function callback(auditResults) {
}
auditResults.done();
});
-}); \ No newline at end of file
+});
diff --git a/chrome/common/extensions/docs/examples/api/eventPage/basic/background.js b/chrome/common/extensions/docs/examples/api/eventPage/basic/background.js
index f94543f..ec6d68f 100644
--- a/chrome/common/extensions/docs/examples/api/eventPage/basic/background.js
+++ b/chrome/common/extensions/docs/examples/api/eventPage/basic/background.js
@@ -56,7 +56,7 @@ chrome.experimental.keybinding.onCommand.addListener(function(command) {
chrome.tabs.create({url: "http://www.google.com/"});
});
-chrome.extension.onMessage.addListener(function(msg, _, sendResponse) {
+chrome.runtime.onMessage.addListener(function(msg, _, sendResponse) {
if (msg.setAlarm) {
chrome.alarms.create({delayInMinutes: 0.1});
} else if (msg.delayedResponse) {
diff --git a/chrome/common/extensions/docs/examples/api/eventPage/basic/content.js b/chrome/common/extensions/docs/examples/api/eventPage/basic/content.js
index cf9c603..3bb880c 100644
--- a/chrome/common/extensions/docs/examples/api/eventPage/basic/content.js
+++ b/chrome/common/extensions/docs/examples/api/eventPage/basic/content.js
@@ -22,23 +22,23 @@ addButton("Clear logs", function() {
});
addButton("Send message with delayed response", function() {
- chrome.extension.sendMessage({delayedResponse: true}, function(response) {
+ chrome.runtime.sendMessage({delayedResponse: true}, function(response) {
log("Background page responded: " + response);
});
});
addButton("Show counters", function() {
- chrome.extension.sendMessage({getCounters: true}, function(response) {
+ chrome.runtime.sendMessage({getCounters: true}, function(response) {
log("In-memory counter is: " + response.counter);
log("Persisted counter is: " + response.persistentCounter);
});
});
addButton("Set an alarm", function() {
- chrome.extension.sendMessage({setAlarm: true});
+ chrome.runtime.sendMessage({setAlarm: true});
});
-chrome.extension.onMessage.addListener(function(msg, _, sendResponse) {
+chrome.runtime.onMessage.addListener(function(msg, _, sendResponse) {
log("Got message from background page: " + msg);
});
diff --git a/chrome/common/extensions/docs/examples/api/infobars/sandwichbar/contentscript.js b/chrome/common/extensions/docs/examples/api/infobars/sandwichbar/contentscript.js
index 6fa03ec..db1f3b3 100644
--- a/chrome/common/extensions/docs/examples/api/infobars/sandwichbar/contentscript.js
+++ b/chrome/common/extensions/docs/examples/api/infobars/sandwichbar/contentscript.js
@@ -1,8 +1,7 @@
-/*
- * 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.
- */
+// 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 regex = /sandwich/gi;
matches = document.body.innerText.match(regex);
if (matches) {
@@ -10,4 +9,4 @@ if (matches) {
count: matches.length // Pass the number of matches back.
};
chrome.extension.sendRequest(payload, function(response) {});
-} \ No newline at end of file
+}
diff --git a/chrome/common/extensions/docs/examples/api/messaging/timer/page.js b/chrome/common/extensions/docs/examples/api/messaging/timer/page.js
index 92f8df3..bdbf9bf 100644
--- a/chrome/common/extensions/docs/examples/api/messaging/timer/page.js
+++ b/chrome/common/extensions/docs/examples/api/messaging/timer/page.js
@@ -1,4 +1,8 @@
-chrome.extension.onConnect.addListener(function(port) {
+// Copyright (c) 2013 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.
+
+chrome.runtime.onConnect.addListener(function(port) {
port.onMessage.addListener(function(msg) {
port.postMessage({counter: msg.counter+1});
});
diff --git a/chrome/common/extensions/docs/examples/api/speechInput/basic/background.js b/chrome/common/extensions/docs/examples/api/speechInput/basic/background.js
index 3093b6c..bd9b99a 100644
--- a/chrome/common/extensions/docs/examples/api/speechInput/basic/background.js
+++ b/chrome/common/extensions/docs/examples/api/speechInput/basic/background.js
@@ -14,9 +14,9 @@ chrome.browserAction.onClicked.addListener(function(tab) {
chrome.experimental.speechInput.isRecording(function(recording) {
if (!recording) {
chrome.experimental.speechInput.start({}, function() {
- if (chrome.extension.lastError) {
+ if (chrome.runtime.lastError) {
alert("Couldn't start speech input: " +
- chrome.extension.lastError.message);
+ chrome.runtime.lastError.message);
setStartIcon();
} else {
setStopIcon();
diff --git a/chrome/common/extensions/docs/examples/api/storage/stylizr/popup.js b/chrome/common/extensions/docs/examples/api/storage/stylizr/popup.js
index c19b5c1..fe6b58d 100644
--- a/chrome/common/extensions/docs/examples/api/storage/stylizr/popup.js
+++ b/chrome/common/extensions/docs/examples/api/storage/stylizr/popup.js
@@ -15,7 +15,7 @@ storage.get('css', function(items) {
// If there is CSS specified, inject it into the page.
if (items.css) {
chrome.tabs.insertCSS(null, {code: items.css}, function() {
- if (chrome.extension.lastError) {
+ if (chrome.runtime.lastError) {
message.innerText = 'Not allowed to inject CSS into special page.';
} else {
message.innerText = 'Injected style!';
diff --git a/chrome/common/extensions/docs/examples/extensions/benchmark/background.js b/chrome/common/extensions/docs/examples/extensions/benchmark/background.js
index 1d11a94..06915ea 100644
--- a/chrome/common/extensions/docs/examples/extensions/benchmark/background.js
+++ b/chrome/common/extensions/docs/examples/extensions/benchmark/background.js
@@ -412,7 +412,7 @@ function Benchmark() {
};
}
-chrome.extension.onConnect.addListener(function(port) {
+chrome.runtime.onConnect.addListener(function(port) {
port.onMessage.addListener(function(data) {
if (data.message == "load") {
var benchmark = findBenchmark(data.url);
diff --git a/chrome/common/extensions/docs/examples/extensions/benchmark/script.js b/chrome/common/extensions/docs/examples/extensions/benchmark/script.js
index b35213e..9d7dadd 100644
--- a/chrome/common/extensions/docs/examples/extensions/benchmark/script.js
+++ b/chrome/common/extensions/docs/examples/extensions/benchmark/script.js
@@ -1,5 +1,9 @@
+// Copyright (c) 2013 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.
+
// The port for communicating back to the extension.
-var benchmarkExtensionPort = chrome.extension.connect();
+var benchmarkExtensionPort = chrome.runtime.connect();
// The url is what this page is known to the benchmark as.
// The benchmark uses this id to differentiate the benchmark's
diff --git a/chrome/common/extensions/docs/examples/extensions/catifier/event_page.js b/chrome/common/extensions/docs/examples/extensions/catifier/event_page.js
index 18b6460..2618fdc 100644
--- a/chrome/common/extensions/docs/examples/extensions/catifier/event_page.js
+++ b/chrome/common/extensions/docs/examples/extensions/catifier/event_page.js
@@ -47,8 +47,8 @@ function registerRules() {
};
var callback = function() {
- if (chrome.extension.lastError) {
- console.error('Error adding rules: ' + chrome.extension.lastError);
+ if (chrome.runtime.lastError) {
+ console.error('Error adding rules: ' + chrome.runtime.lastError);
} else {
console.info('Rules successfully installed');
chrome.declarativeWebRequest.onRequest.getRules(null,
@@ -70,8 +70,8 @@ function setup() {
chrome.declarativeWebRequest.onRequest.removeRules(
null,
function() {
- if (chrome.extension.lastError) {
- console.error('Error clearing rules: ' + chrome.extension.lastError);
+ if (chrome.runtime.lastError) {
+ console.error('Error clearing rules: ' + chrome.runtime.lastError);
} else {
registerRules();
}
diff --git a/chrome/common/extensions/docs/examples/extensions/email_this_page/background.js b/chrome/common/extensions/docs/examples/extensions/email_this_page/background.js
index a0fd3c3..a16ef80 100644
--- a/chrome/common/extensions/docs/examples/extensions/email_this_page/background.js
+++ b/chrome/common/extensions/docs/examples/extensions/email_this_page/background.js
@@ -42,7 +42,7 @@ function executeMailto(tab_id, subject, body, selection) {
}
}
-chrome.extension.onConnect.addListener(function(port) {
+chrome.runtime.onConnect.addListener(function(port) {
var tab = port.sender.tab;
// This will get called by the content script we execute in
diff --git a/chrome/common/extensions/docs/examples/extensions/email_this_page/content_script.js b/chrome/common/extensions/docs/examples/extensions/email_this_page/content_script.js
index fc0ef93..08744ef 100644
--- a/chrome/common/extensions/docs/examples/extensions/email_this_page/content_script.js
+++ b/chrome/common/extensions/docs/examples/extensions/email_this_page/content_script.js
@@ -1,12 +1,10 @@
-/*
- * Copyright (c) 2009 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.
- */
+// Copyright (c) 2009 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 additionalInfo = {
"title": document.title,
"selection": window.getSelection().toString()
};
-chrome.extension.connect().postMessage(additionalInfo);
+chrome.runtime.connect().postMessage(additionalInfo);
diff --git a/chrome/common/extensions/docs/examples/extensions/native_messaging/popup.js b/chrome/common/extensions/docs/examples/extensions/native_messaging/popup.js
index 07757e1..30f8778 100644
--- a/chrome/common/extensions/docs/examples/extensions/native_messaging/popup.js
+++ b/chrome/common/extensions/docs/examples/extensions/native_messaging/popup.js
@@ -14,7 +14,7 @@ function gotNativeMessage(message) {
function sendNativeMessage() {
if (!port) {
- port = chrome.extension.connectNative('echo.py', {"message": "Hi there!"});
+ port = chrome.runtime.connectNative('echo.py', {"message": "Hi there!"});
port.onMessage.addListener(gotNativeMessage);
document.getElementById('input-text').style.display = 'block';
document.getElementById('send-native-message').innerHTML = 'Send Message';
diff --git a/chrome/common/extensions/docs/examples/extensions/plugin_settings/js/chrome_stubs.js b/chrome/common/extensions/docs/examples/extensions/plugin_settings/js/chrome_stubs.js
index 38b7514..51058d6 100644
--- a/chrome/common/extensions/docs/examples/extensions/plugin_settings/js/chrome_stubs.js
+++ b/chrome/common/extensions/docs/examples/extensions/plugin_settings/js/chrome_stubs.js
@@ -18,11 +18,11 @@ chrome.contentSettings.plugins = {
var pattern = details.primaryPattern;
var setting = details.setting;
if (pattern == '__invalid_pattern') {
- chrome.extension.lastError = {'message': 'Invalid pattern'};
+ chrome.runtime.lastError = {'message': 'Invalid pattern'};
} else if (setting == '__invalid_setting') {
throw Error('Invalid setting');
} else {
- chrome.extension.lastError = undefined;
+ chrome.runtime.lastError = undefined;
_rules[pattern] = setting;
}
callback();
diff --git a/chrome/common/extensions/docs/examples/extensions/plugin_settings/js/main.js b/chrome/common/extensions/docs/examples/extensions/plugin_settings/js/main.js
index 89aeca6..d86c9f5 100644
--- a/chrome/common/extensions/docs/examples/extensions/plugin_settings/js/main.js
+++ b/chrome/common/extensions/docs/examples/extensions/plugin_settings/js/main.js
@@ -9,9 +9,9 @@
document.addEventListener('DOMContentLoaded', function() {
chrome.contentSettings.plugins.getResourceIdentifiers(function(r) {
- if (chrome.extension.lastError) {
+ if (chrome.runtime.lastError) {
$('error').textContent =
- 'Error: ' + chrome.extension.lastError.message;
+ 'Error: ' + chrome.runtime.lastError.message;
return;
}
var pluginList = $('plugin-list');
diff --git a/chrome/common/extensions/docs/examples/extensions/plugin_settings/js/plugin_settings.js b/chrome/common/extensions/docs/examples/extensions/plugin_settings/js/plugin_settings.js
index 253240d..fadf7cf 100644
--- a/chrome/common/extensions/docs/examples/extensions/plugin_settings/js/plugin_settings.js
+++ b/chrome/common/extensions/docs/examples/extensions/plugin_settings/js/plugin_settings.js
@@ -51,7 +51,7 @@ cr.define('pluginSettings', function() {
* @private
*/
didClearRules_: function(callback) {
- if (chrome.extension.lastError) {
+ if (chrome.runtime.lastError) {
console.error('Error clearing rules');
callback();
return;
@@ -95,10 +95,10 @@ cr.define('pluginSettings', function() {
* @private
*/
didSetContentSetting_: function(plugin, pattern, key, counter, callback) {
- if (chrome.extension.lastError) {
+ if (chrome.runtime.lastError) {
console.error(
'Error restoring [' + key + ': ' + value + ']: ' +
- chrome.extension.lastError.message);
+ chrome.runtime.lastError.message);
window.localStorage.removeItem(key);
}
counter.value--;
@@ -124,8 +124,8 @@ cr.define('pluginSettings', function() {
'resourceIdentifier': { 'id': plugin },
'setting': setting,
}, function() {
- if (chrome.extension.lastError) {
- callback(chrome.extension.lastError.message);
+ if (chrome.runtime.lastError) {
+ callback(chrome.runtime.lastError.message);
} else {
window.localStorage.setItem(JSON.stringify([plugin, pattern]),
setting);
diff --git a/chrome/common/extensions/docs/examples/extensions/proxy_configuration/proxy_form_controller.js b/chrome/common/extensions/docs/examples/extensions/proxy_configuration/proxy_form_controller.js
index 80f909b..26c70dc 100644
--- a/chrome/common/extensions/docs/examples/extensions/proxy_configuration/proxy_form_controller.js
+++ b/chrome/common/extensions/docs/examples/extensions/proxy_configuration/proxy_form_controller.js
@@ -524,7 +524,7 @@ ProxyFormController.prototype = {
* @private
*/
callbackForRegularSettings_: function() {
- if (chrome.extension.lastError) {
+ if (chrome.runtime.lastError) {
this.generateAlert_(chrome.i18n.getMessage('errorSettingRegularProxy'));
return;
}
@@ -545,7 +545,7 @@ ProxyFormController.prototype = {
* @private
*/
callbackForIncognitoSettings_: function() {
- if (chrome.extension.lastError) {
+ if (chrome.runtime.lastError) {
this.generateAlert_(chrome.i18n.getMessage('errorSettingIncognitoProxy'));
return;
}
diff --git a/chrome/common/extensions/docs/examples/extensions/talking_alarm_clock/background.js b/chrome/common/extensions/docs/examples/extensions/talking_alarm_clock/background.js
index ae94ff8..38c5917 100644
--- a/chrome/common/extensions/docs/examples/extensions/talking_alarm_clock/background.js
+++ b/chrome/common/extensions/docs/examples/extensions/talking_alarm_clock/background.js
@@ -114,7 +114,7 @@ function onLocalStorageChange() {
function initBackground() {
window.addEventListener('storage', onLocalStorageChange, false);
- chrome.extension.onConnect.addListener(function(popupPort) {
+ chrome.runtime.onConnect.addListener(function(popupPort) {
port = popupPort;
port.onDisconnect.addListener(function() {
port = null;
diff --git a/chrome/common/extensions/docs/examples/extensions/talking_alarm_clock/popup.js b/chrome/common/extensions/docs/examples/extensions/talking_alarm_clock/popup.js
index 1f0bf06..30b8085 100644
--- a/chrome/common/extensions/docs/examples/extensions/talking_alarm_clock/popup.js
+++ b/chrome/common/extensions/docs/examples/extensions/talking_alarm_clock/popup.js
@@ -190,7 +190,7 @@ function addOutlineStyleListeners() {
function load() {
try {
- port = chrome.extension.connect();
+ port = chrome.runtime.connect();
port.onMessage.addListener(function(msg) {
if (msg.cmd == 'anim') {
displayAlarmAnimation();
diff --git a/chrome/common/extensions/docs/examples/extensions/ttsdemo/ttsdemo.js b/chrome/common/extensions/docs/examples/extensions/ttsdemo/ttsdemo.js
index d4e0a6f..85ee27d 100644
--- a/chrome/common/extensions/docs/examples/extensions/ttsdemo/ttsdemo.js
+++ b/chrome/common/extensions/docs/examples/extensions/ttsdemo/ttsdemo.js
@@ -86,8 +86,8 @@ function speak(str, options, highlightText) {
};
chrome.tts.speak(
str, options, function() {
- if (chrome.extension.lastError) {
- console.log('TTS Error: ' + chrome.extension.lastError.message);
+ if (chrome.runtime.lastError) {
+ console.log('TTS Error: ' + chrome.runtime.lastError.message);
}
});
ttsStatus.innerHTML = 'Busy';
diff --git a/chrome/common/extensions/docs/templates/articles/content_scripts.html b/chrome/common/extensions/docs/templates/articles/content_scripts.html
index ec10423..5cbb2be 100644
--- a/chrome/common/extensions/docs/templates/articles/content_scripts.html
+++ b/chrome/common/extensions/docs/templates/articles/content_scripts.html
@@ -342,7 +342,7 @@ button.addEventListener("click", function() {
<p>An example can be accomplished using window.postMessage (or window.webkitPostMessage for Transferable objects):</p>
<pre>contentscript.js
================
-var port = chrome.extension.connect();
+var port = chrome.runtime.connect();
window.addEventListener("message", function(event) {
// We only accept messages from ourselves
diff --git a/chrome/common/extensions/docs/templates/articles/manifestVersion.html b/chrome/common/extensions/docs/templates/articles/manifestVersion.html
index 35fbe3a..b3c7563 100644
--- a/chrome/common/extensions/docs/templates/articles/manifestVersion.html
+++ b/chrome/common/extensions/docs/templates/articles/manifestVersion.html
@@ -220,7 +220,7 @@
<li>
<p>
<code>Port.tab</code> is gone. Use
- $ref:extension.Port
+ $ref:runtime.Port
instead.
</p>
</li>
diff --git a/chrome/common/extensions/docs/templates/articles/whats_new.html b/chrome/common/extensions/docs/templates/articles/whats_new.html
index 4d92fbe..1588f74 100644
--- a/chrome/common/extensions/docs/templates/articles/whats_new.html
+++ b/chrome/common/extensions/docs/templates/articles/whats_new.html
@@ -115,7 +115,7 @@ made in recent releases.
<li>The <code>sendRequest()</code> method
has been deprecated in favor of the
<code>sendMessage()</code> method for both the
- $ref:extension.sendMessage and
+ $ref:runtime.sendMessage and
$ref:tabs.sendMessage.</li>
<li>The <a href="external_extensions.html">external_extensions.json file</a>
has been deprecated in favor of individual
diff --git a/chrome/common/extensions/docs/templates/intros/experimental_speechInput.html b/chrome/common/extensions/docs/templates/intros/experimental_speechInput.html
index 9c9f994..1db1334 100644
--- a/chrome/common/extensions/docs/templates/intros/experimental_speechInput.html
+++ b/chrome/common/extensions/docs/templates/intros/experimental_speechInput.html
@@ -22,13 +22,13 @@ For example:</p>
<h2 id="howToStart">How to start speech recognition</h2>
<p>To start recognizing speech an extension must call the <code>start()</code>
method. If provided, your callback will be called once recording has
-successfully started. In case of error <code>chrome.extension.lastError</code>
+successfully started. In case of error <code>chrome.runtime.lastError</code>
will be set.</p>
<p>This API provides exclusive access to the default recording device to the
first extension requesting it. Consequently, any calls to <code>start()</code>
when the device is being used by another extension or web page will fail and set
-<code>chrome.extension.lastError</code>. The message <code>requestDenied</code>
+<code>chrome.runtime.lastError</code>. The message <code>requestDenied</code>
will be set if another extension in the same profile is making use of the API.
Otherwise <code>noRecordingDeviceFound</code>, <code>recordingDeviceInUse</code>
or <code>unableToStart</code> will be set depending on the situation.</p>
@@ -71,7 +71,7 @@ It is safe to call <code>start()</code> again from the error callback.</p>
<h2 id="howToStop">How to stop recording</h2>
<p>To stop speech recognition call the <code>stop()</code> method. If provided,
the callback function will be called once recording has successfully stopped.
-In case of error <code>chrome.extension.lastError</code> will be set.
+In case of error <code>chrome.runtime.lastError</code> will be set.
</p>
@@ -90,8 +90,8 @@ continued period of silence).
most likely recognition result.</p>
<pre>
function checkStart() {
- if (chrome.extension.lastError) {
- alert("Couldn't start speech input: " + chrome.extension.lastError.message);
+ if (chrome.runtime.lastError) {
+ alert("Couldn't start speech input: " + chrome.runtime.lastError.message);
}
}
@@ -106,4 +106,4 @@ function recognitionSucceeded(result) {
chrome.experimental.speechInput.onError.addListener(recognitionFailed);
chrome.experimental.speechInput.onResult.addListener(recognitionSucceeded);
chrome.experimental.speechInput.start({ "language": "en" }, checkStart);
-</pre> \ No newline at end of file
+</pre>
diff --git a/chrome/common/extensions/docs/templates/intros/privacy.html b/chrome/common/extensions/docs/templates/intros/privacy.html
index c7657ea..2a80ae5 100644
--- a/chrome/common/extensions/docs/templates/intros/privacy.html
+++ b/chrome/common/extensions/docs/templates/intros/privacy.html
@@ -73,10 +73,10 @@
<pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
if (details.levelOfControl === 'controllable_by_this_extension') {
chrome.privacy.services.autofillEnabled.set({ value: true }, function() {
- if (chrome.extension.lastError === undefined)
+ if (chrome.runtime.lastError === undefined)
console.log("Hooray, it worked!");
else
- console.log("Sadness!", chrome.extension.lastError);
+ console.log("Sadness!", chrome.runtime.lastError);
}
}
});</pre>
@@ -179,10 +179,10 @@
<pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
if (details.levelOfControl === 'controllable_by_this_extension') {
chrome.privacy.services.autofillEnabled.set({ value: true }, function() {
- if (chrome.extension.lastError === undefined)
+ if (chrome.runtime.lastError === undefined)
console.log("Hooray, it worked!");
else
- console.log("Sadness!", chrome.extension.lastError);
+ console.log("Sadness!", chrome.runtime.lastError);
}
}
});</pre>
@@ -206,4 +206,4 @@
<p>
For example code, see the
<a href="samples.html#privacy">Privacy API samples</a>.
-</p> \ No newline at end of file
+</p>
diff --git a/chrome/common/extensions/docs/templates/intros/tts.html b/chrome/common/extensions/docs/templates/intros/tts.html
index 1dfaca8..a7387d6 100644
--- a/chrome/common/extensions/docs/templates/intros/tts.html
+++ b/chrome/common/extensions/docs/templates/intros/tts.html
@@ -87,8 +87,8 @@ to see if there were any errors.</p>
utterance,
options,
function() {
- if (chrome.extension.lastError) {
- console.log('Error: ' + chrome.extension.lastError.message);
+ if (chrome.runtime.lastError) {
+ console.log('Error: ' + chrome.runtime.lastError.message);
}
});</pre>
@@ -202,4 +202,4 @@ argument:</p>
console.log(' extension id: ' + voices[i].extensionId);
console.log(' event types: ' + voices[i].eventTypes);
}
- });</pre> \ No newline at end of file
+ });</pre>