summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 18:25:01 +0000
committerrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-05 18:25:01 +0000
commit28c47ee963812e92e2eb921ed1778f5db74041bc (patch)
tree4fe3226b1a17e845379d73b4ce29ae8504d39860 /chrome
parente4c893a1534ba215f0b66eb9ee3ac87bc8c72143 (diff)
downloadchromium_src-28c47ee963812e92e2eb921ed1778f5db74041bc.zip
chromium_src-28c47ee963812e92e2eb921ed1778f5db74041bc.tar.gz
chromium_src-28c47ee963812e92e2eb921ed1778f5db74041bc.tar.bz2
BUG=11200
R=aa Review URL: http://codereview.chromium.org/110001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15310 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/extension_messages_unittest.cc4
-rwxr-xr-xchrome/renderer/extensions/extension_api_client_unittest.cc128
-rw-r--r--chrome/renderer/extensions/extension_process_bindings.cc2
-rwxr-xr-xchrome/renderer/extensions/renderer_extension_bindings.cc8
-rwxr-xr-xchrome/renderer/renderer_resources.grd2
-rw-r--r--chrome/renderer/resources/event_bindings.js54
-rw-r--r--chrome/renderer/resources/extension_process_bindings.js268
-rwxr-xr-xchrome/renderer/resources/json_schema.js60
-rw-r--r--chrome/renderer/resources/renderer_extension_bindings.js32
-rw-r--r--chrome/renderer/user_script_slave.cc4
-rwxr-xr-xchrome/test/data/extensions/json_schema_test.js6
-rw-r--r--chrome/test/data/extensions/samples/bookmarks/bookmark_api.html16
-rw-r--r--chrome/test/data/extensions/samples/bookmarks/bookmark_view.html20
-rw-r--r--chrome/test/data/extensions/samples/gmail/gmail_checker.html2
-rw-r--r--chrome/test/data/extensions/samples/subscribe/toolstrip.html4
-rw-r--r--chrome/test/data/extensions/samples/tabs/tabs_api.html53
16 files changed, 331 insertions, 332 deletions
diff --git a/chrome/browser/extensions/extension_messages_unittest.cc b/chrome/browser/extensions/extension_messages_unittest.cc
index 606c301..4c31dc3 100644
--- a/chrome/browser/extensions/extension_messages_unittest.cc
+++ b/chrome/browser/extensions/extension_messages_unittest.cc
@@ -14,7 +14,7 @@ TEST_F(RenderViewTest, ExtensionMessagesOpenChannel) {
render_thread_.sink().ClearMessages();
LoadHTML("<body></body>");
ExecuteJavaScript(
- "var e = new chromium.Extension('foobar');"
+ "var e = new chrome.Extension('foobar');"
"var port = e.connect();"
"port.onMessage.addListener(doOnMessage);"
"port.postMessage({message: 'content ready'});"
@@ -57,7 +57,7 @@ TEST_F(RenderViewTest, ExtensionMessagesOpenChannel) {
TEST_F(RenderViewTest, ExtensionMessagesOnConnect) {
LoadHTML("<body></body>");
ExecuteJavaScript(
- "chromium.self.onConnect.addListener(function (port) {"
+ "chrome.self.onConnect.addListener(function (port) {"
" port.onMessage.addListener(doOnMessage);"
" port.postMessage({message: 'onconnect from ' + port.tab.url});"
"});"
diff --git a/chrome/renderer/extensions/extension_api_client_unittest.cc b/chrome/renderer/extensions/extension_api_client_unittest.cc
index 6233dfb..7e786b7 100755
--- a/chrome/renderer/extensions/extension_api_client_unittest.cc
+++ b/chrome/renderer/extensions/extension_api_client_unittest.cc
@@ -75,7 +75,7 @@ TEST_F(ExtensionAPIClientTest, CallbackDispatching) {
" 'incorrect result');"
" console.log('pass')"
"}"
- "chromium.tabs.create({}, callback);"
+ "chrome.tabs.create({}, callback);"
);
EXPECT_EQ("", GetConsoleMessage());
@@ -105,150 +105,150 @@ TEST_F(ExtensionAPIClientTest, CallbackDispatching) {
// Window API tests
TEST_F(ExtensionAPIClientTest, GetWindow) {
- ExpectJsFail("chromium.windows.get(32, function(){}, 20);",
+ ExpectJsFail("chrome.windows.get(32, function(){}, 20);",
"Uncaught Error: Too many arguments.");
- ExpectJsFail("chromium.windows.get(32);",
+ ExpectJsFail("chrome.windows.get(32);",
"Uncaught Error: Parameter 1 is required.");
- ExpectJsFail("chromium.windows.get('abc', function(){});",
+ ExpectJsFail("chrome.windows.get('abc', function(){});",
"Uncaught Error: Invalid value for argument 0. "
"Expected 'integer' but got 'string'.");
- ExpectJsFail("chromium.windows.get(1, 1);",
+ ExpectJsFail("chrome.windows.get(1, 1);",
"Uncaught Error: Invalid value for argument 1. "
"Expected 'function' but got 'integer'.");
- ExpectJsPass("chromium.windows.get(2, function(){})",
+ ExpectJsPass("chrome.windows.get(2, function(){})",
"GetWindow", "2");
}
TEST_F(ExtensionAPIClientTest, GetCurentWindow) {
- ExpectJsFail("chromium.windows.getCurrent(function(){}, 20);",
+ ExpectJsFail("chrome.windows.getCurrent(function(){}, 20);",
"Uncaught Error: Too many arguments.");
- ExpectJsFail("chromium.windows.getCurrent();",
+ ExpectJsFail("chrome.windows.getCurrent();",
"Uncaught Error: Parameter 0 is required.");
- ExpectJsFail("chromium.windows.getCurrent('abc');",
+ ExpectJsFail("chrome.windows.getCurrent('abc');",
"Uncaught Error: Invalid value for argument 0. "
"Expected 'function' but got 'string'.");
- ExpectJsPass("chromium.windows.getCurrent(function(){})",
+ ExpectJsPass("chrome.windows.getCurrent(function(){})",
"GetCurrentWindow", "null");
}
TEST_F(ExtensionAPIClientTest, GetFocusedWindow) {
- ExpectJsFail("chromium.windows.getFocused(function(){}, 20);",
+ ExpectJsFail("chrome.windows.getFocused(function(){}, 20);",
"Uncaught Error: Too many arguments.");
- ExpectJsFail("chromium.windows.getFocused();",
+ ExpectJsFail("chrome.windows.getFocused();",
"Uncaught Error: Parameter 0 is required.");
- ExpectJsFail("chromium.windows.getFocused('abc');",
+ ExpectJsFail("chrome.windows.getFocused('abc');",
"Uncaught Error: Invalid value for argument 0. "
"Expected 'function' but got 'string'.");
- ExpectJsPass("chromium.windows.getFocused(function(){})",
+ ExpectJsPass("chrome.windows.getFocused(function(){})",
"GetFocusedWindow", "null");
}
TEST_F(ExtensionAPIClientTest, GetAllWindows) {
- ExpectJsFail("chromium.windows.getAll(true, function(){}, 20);",
+ ExpectJsFail("chrome.windows.getAll(true, function(){}, 20);",
"Uncaught Error: Too many arguments.");
- ExpectJsFail("chromium.windows.getAll(1, function(){});",
+ ExpectJsFail("chrome.windows.getAll(1, function(){});",
"Uncaught Error: Invalid value for argument 0. "
"Expected 'boolean' but got 'integer'.");
- ExpectJsPass("chromium.windows.getAll(true, function(){})",
+ ExpectJsPass("chrome.windows.getAll(true, function(){})",
"GetAllWindows", "true");
- ExpectJsPass("chromium.windows.getAll(null, function(){})",
+ ExpectJsPass("chrome.windows.getAll(null, function(){})",
"GetAllWindows", "null");
- ExpectJsPass("chromium.windows.getAll(undefined, function(){})",
+ ExpectJsPass("chrome.windows.getAll(undefined, function(){})",
"GetAllWindows", "null");
}
// Tab API tests
TEST_F(ExtensionAPIClientTest, GetTab) {
- ExpectJsFail("chromium.tabs.get(32, function(){}, 20);",
+ ExpectJsFail("chrome.tabs.get(32, function(){}, 20);",
"Uncaught Error: Too many arguments.");
- ExpectJsFail("chromium.tabs.get(32);",
+ ExpectJsFail("chrome.tabs.get(32);",
"Uncaught Error: Parameter 1 is required.");
- ExpectJsFail("chromium.tabs.get('abc', function(){});",
+ ExpectJsFail("chrome.tabs.get('abc', function(){});",
"Uncaught Error: Invalid value for argument 0. "
"Expected 'integer' but got 'string'.");
- ExpectJsFail("chromium.tabs.get(1, 1);",
+ ExpectJsFail("chrome.tabs.get(1, 1);",
"Uncaught Error: Invalid value for argument 1. "
"Expected 'function' but got 'integer'.");
- ExpectJsPass("chromium.tabs.get(2, function(){})",
+ ExpectJsPass("chrome.tabs.get(2, function(){})",
"GetTab", "2");
}
TEST_F(ExtensionAPIClientTest, GetSelectedTab) {
- ExpectJsFail("chromium.tabs.getSelected(32, function(){}, 20);",
+ ExpectJsFail("chrome.tabs.getSelected(32, function(){}, 20);",
"Uncaught Error: Too many arguments.");
- ExpectJsFail("chromium.tabs.getSelected(32);",
+ ExpectJsFail("chrome.tabs.getSelected(32);",
"Uncaught Error: Parameter 1 is required.");
- ExpectJsFail("chromium.tabs.getSelected('abc', function(){});",
+ ExpectJsFail("chrome.tabs.getSelected('abc', function(){});",
"Uncaught Error: Invalid value for argument 0. "
"Expected 'integer' but got 'string'.");
- ExpectJsFail("chromium.tabs.getSelected(1, 1);",
+ ExpectJsFail("chrome.tabs.getSelected(1, 1);",
"Uncaught Error: Invalid value for argument 1. "
"Expected 'function' but got 'integer'.");
- ExpectJsPass("chromium.tabs.getSelected(2, function(){})",
+ ExpectJsPass("chrome.tabs.getSelected(2, function(){})",
"GetSelectedTab", "2");
- ExpectJsPass("chromium.tabs.getSelected(null, function(){})",
+ ExpectJsPass("chrome.tabs.getSelected(null, function(){})",
"GetSelectedTab", "null");
}
TEST_F(ExtensionAPIClientTest, GetAllTabsInWindow) {
- ExpectJsFail("chromium.tabs.getAllInWindow(42, function(){}, 'asd');",
+ ExpectJsFail("chrome.tabs.getAllInWindow(42, function(){}, 'asd');",
"Uncaught Error: Too many arguments.");
- ExpectJsFail("chromium.tabs.getAllInWindow(32);",
+ ExpectJsFail("chrome.tabs.getAllInWindow(32);",
"Uncaught Error: Parameter 1 is required.");
- ExpectJsFail("chromium.tabs.getAllInWindow(1, 1);",
+ ExpectJsFail("chrome.tabs.getAllInWindow(1, 1);",
"Uncaught Error: Invalid value for argument 1. "
"Expected 'function' but got 'integer'.");
- ExpectJsFail("chromium.tabs.getAllInWindow('asd', function(){});",
+ ExpectJsFail("chrome.tabs.getAllInWindow('asd', function(){});",
"Uncaught Error: Invalid value for argument 0. "
"Expected 'integer' but got 'string'.");
- ExpectJsPass("chromium.tabs.getAllInWindow(32, function(){})",
+ ExpectJsPass("chrome.tabs.getAllInWindow(32, function(){})",
"GetAllTabsInWindow", "32");
- ExpectJsPass("chromium.tabs.getAllInWindow(undefined, function(){})",
+ ExpectJsPass("chrome.tabs.getAllInWindow(undefined, function(){})",
"GetAllTabsInWindow", "null");
}
TEST_F(ExtensionAPIClientTest, CreateTab) {
- ExpectJsFail("chromium.tabs.create({windowId: 'foo'}, function(){});",
+ ExpectJsFail("chrome.tabs.create({windowId: 'foo'}, function(){});",
"Uncaught Error: Invalid value for argument 0. Property "
"'windowId': Expected 'integer' but got 'string'.");
- ExpectJsFail("chromium.tabs.create({url: 42}, function(){});",
+ ExpectJsFail("chrome.tabs.create({url: 42}, function(){});",
"Uncaught Error: Invalid value for argument 0. Property "
"'url': Expected 'string' but got 'integer'.");
- ExpectJsFail("chromium.tabs.create({foo: 42}, function(){});",
+ ExpectJsFail("chrome.tabs.create({foo: 42}, function(){});",
"Uncaught Error: Invalid value for argument 0. Property "
"'foo': Unexpected property.");
- ExpectJsPass("chromium.tabs.create({"
+ ExpectJsPass("chrome.tabs.create({"
" url:'http://www.google.com/',"
" selected:true,"
" index: 2,"
@@ -262,16 +262,16 @@ TEST_F(ExtensionAPIClientTest, CreateTab) {
}
TEST_F(ExtensionAPIClientTest, UpdateTab) {
- ExpectJsFail("chromium.tabs.update(null);",
+ ExpectJsFail("chrome.tabs.update(null);",
"Uncaught Error: Parameter 0 is required.");
- ExpectJsFail("chromium.tabs.update(42, {selected: 'foo'});",
+ ExpectJsFail("chrome.tabs.update(42, {selected: 'foo'});",
"Uncaught Error: Invalid value for argument 1. Property "
"'selected': Expected 'boolean' but got 'string'.");
- ExpectJsFail("chromium.tabs.update(42, {url: 42});",
+ ExpectJsFail("chrome.tabs.update(42, {url: 42});",
"Uncaught Error: Invalid value for argument 1. Property "
"'url': Expected 'string' but got 'integer'.");
- ExpectJsPass("chromium.tabs.update(42, {"
+ ExpectJsPass("chrome.tabs.update(42, {"
" url:'http://www.google.com/',"
" selected:true"
"})",
@@ -282,16 +282,16 @@ TEST_F(ExtensionAPIClientTest, UpdateTab) {
}
TEST_F(ExtensionAPIClientTest, MoveTab) {
- ExpectJsFail("chromium.tabs.move(null);",
+ ExpectJsFail("chrome.tabs.move(null);",
"Uncaught Error: Parameter 0 is required.");
- ExpectJsFail("chromium.tabs.move(42, {index: 'foo'});",
+ ExpectJsFail("chrome.tabs.move(42, {index: 'foo'});",
"Uncaught Error: Invalid value for argument 1. Property "
"'index': Expected 'integer' but got 'string'.");
- ExpectJsFail("chromium.tabs.move(42, {index: 3, windowId: 'foo'});",
+ ExpectJsFail("chrome.tabs.move(42, {index: 3, windowId: 'foo'});",
"Uncaught Error: Invalid value for argument 1. Property "
"'windowId': Expected 'integer' but got 'string'.");
- ExpectJsPass("chromium.tabs.move(42, {"
+ ExpectJsPass("chrome.tabs.move(42, {"
" index:3,"
" windowId:21"
"})",
@@ -302,10 +302,10 @@ TEST_F(ExtensionAPIClientTest, MoveTab) {
}
TEST_F(ExtensionAPIClientTest, RemoveTab) {
- ExpectJsFail("chromium.tabs.remove('foobar', function(){});",
+ ExpectJsFail("chrome.tabs.remove('foobar', function(){});",
"Uncaught Error: Too many arguments.");
- ExpectJsPass("chromium.tabs.remove(21)", "RemoveTab", "21");
+ ExpectJsPass("chrome.tabs.remove(21)", "RemoveTab", "21");
}
// Bookmark API tests
@@ -313,71 +313,71 @@ TEST_F(ExtensionAPIClientTest, RemoveTab) {
TEST_F(ExtensionAPIClientTest, CreateBookmark) {
ExpectJsFail(
- "chromium.bookmarks.create({parentId:'x', title:0}, function(){})",
+ "chrome.bookmarks.create({parentId:'x', title:0}, function(){})",
"Uncaught Error: Invalid value for argument 0. "
"Property 'parentId': Expected 'integer' but got 'string', "
"Property 'title': Expected 'string' but got 'integer'.");
ExpectJsPass(
- "chromium.bookmarks.create({parentId:0, title:'x'}, function(){})",
+ "chrome.bookmarks.create({parentId:0, title:'x'}, function(){})",
"CreateBookmark",
"{\"parentId\":0,\"title\":\"x\"}");
}
TEST_F(ExtensionAPIClientTest, GetBookmarks) {
- ExpectJsPass("chromium.bookmarks.get([], function(){});",
+ ExpectJsPass("chrome.bookmarks.get([], function(){});",
"GetBookmarks",
"[]");
- ExpectJsPass("chromium.bookmarks.get([0,1,2,3], function(){});",
+ ExpectJsPass("chrome.bookmarks.get([0,1,2,3], function(){});",
"GetBookmarks",
"[0,1,2,3]");
- ExpectJsPass("chromium.bookmarks.get(null, function(){});",
+ ExpectJsPass("chrome.bookmarks.get(null, function(){});",
"GetBookmarks",
"null");
- ExpectJsFail("chromium.bookmarks.get({}, function(){});",
+ ExpectJsFail("chrome.bookmarks.get({}, function(){});",
"Uncaught Error: Invalid value for argument 0. "
"Expected 'array' but got 'object'.");
}
TEST_F(ExtensionAPIClientTest, GetBookmarkChildren) {
- ExpectJsPass("chromium.bookmarks.getChildren(42, function(){});",
+ ExpectJsPass("chrome.bookmarks.getChildren(42, function(){});",
"GetBookmarkChildren",
"42");
}
TEST_F(ExtensionAPIClientTest, GetBookmarkTree) {
- ExpectJsPass("chromium.bookmarks.getTree(function(){});",
+ ExpectJsPass("chrome.bookmarks.getTree(function(){});",
"GetBookmarkTree",
"null");
}
TEST_F(ExtensionAPIClientTest, SearchBookmarks) {
- ExpectJsPass("chromium.bookmarks.search('hello',function(){});",
+ ExpectJsPass("chrome.bookmarks.search('hello',function(){});",
"SearchBookmarks",
"\"hello\"");
}
TEST_F(ExtensionAPIClientTest, RemoveBookmark) {
- ExpectJsPass("chromium.bookmarks.remove({id:42});",
+ ExpectJsPass("chrome.bookmarks.remove({id:42});",
"RemoveBookmark",
"{\"id\":42}");
}
TEST_F(ExtensionAPIClientTest, MoveBookmark) {
- ExpectJsPass("chromium.bookmarks.move({id:42,parentId:1,index:0});",
+ ExpectJsPass("chrome.bookmarks.move({id:42,parentId:1,index:0});",
"MoveBookmark",
"{\"id\":42,\"parentId\":1,\"index\":0}");
}
TEST_F(ExtensionAPIClientTest, SetBookmarkTitle) {
- ExpectJsPass("chromium.bookmarks.setTitle({id:42,title:'x'});",
+ ExpectJsPass("chrome.bookmarks.setTitle({id:42,title:'x'});",
"SetBookmarkTitle",
"{\"id\":42,\"title\":\"x\"}");
}
TEST_F(ExtensionAPIClientTest, EnablePageAction) {
- ExpectJsPass("chromium.pageActions.enableForTab("
- "\"dummy\", {tabId: 0, url: \"http://foo/\"});",
+ ExpectJsPass("chrome.pageActions.enableForTab("
+ "\"dummy\", {tabId: 0, url: \"http://foo/\"});",
"EnablePageAction",
"[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]");
}
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc
index 1c1ac79..597ac40 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -100,7 +100,7 @@ void ExtensionProcessBindings::SetFunctionNames(
void ExtensionProcessBindings::ExecuteCallbackInFrame(
WebFrame* frame, int callback_id, const std::string& response) {
- std::string code = "chromium.dispatchCallback_(";
+ std::string code = "chrome.dispatchCallback_(";
code += IntToString(callback_id);
code += ", '";
diff --git a/chrome/renderer/extensions/renderer_extension_bindings.cc b/chrome/renderer/extensions/renderer_extension_bindings.cc
index fe0656b..4d894a4 100755
--- a/chrome/renderer/extensions/renderer_extension_bindings.cc
+++ b/chrome/renderer/extensions/renderer_extension_bindings.cc
@@ -15,7 +15,7 @@
// Message passing API example (in a content script):
// var extension =
-// new chromium.Extension('00123456789abcdef0123456789abcdef0123456');
+// new chrome.Extension('00123456789abcdef0123456789abcdef0123456');
// var port = extension.connect();
// port.postMessage('Can you hear me now?');
// port.onmessage.addListener(function(msg, port) {
@@ -94,7 +94,7 @@ void RendererExtensionBindings::HandleConnect(int port_id,
v8::Handle<v8::Value> argv[2];
argv[0] = v8::Integer::New(port_id);
argv[1] = v8::String::New(tab_json.c_str());
- EventBindings::CallFunction("chromium.Port.dispatchOnConnect_",
+ EventBindings::CallFunction("chrome.Port.dispatchOnConnect_",
arraysize(argv), argv);
}
@@ -104,7 +104,7 @@ void RendererExtensionBindings::HandleMessage(const std::string& message,
v8::Handle<v8::Value> argv[2];
argv[0] = v8::String::New(message.c_str());
argv[1] = v8::Integer::New(port_id);
- EventBindings::CallFunction("chromium.Port.dispatchOnMessage_",
+ EventBindings::CallFunction("chrome.Port.dispatchOnMessage_",
arraysize(argv), argv);
}
@@ -115,6 +115,6 @@ void RendererExtensionBindings::HandleEvent(const std::string& event_name,
argv[0] = v8::String::New(event_name.c_str());
argv[1] = v8::String::New(args.c_str());
- EventBindings::CallFunction("chromium.Event.dispatchJSON_",
+ EventBindings::CallFunction("chrome.Event.dispatchJSON_",
arraysize(argv), argv);
}
diff --git a/chrome/renderer/renderer_resources.grd b/chrome/renderer/renderer_resources.grd
index c59e98c..cda253b 100755
--- a/chrome/renderer/renderer_resources.grd
+++ b/chrome/renderer/renderer_resources.grd
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This comment is only here because changes to resources are not picked up
-without changes to the corresponding grd file. -->
+without changes to the corresponding grd file. -->
<grit latest_public_release="0" current_release="1">
<outputs>
<output filename="grit/renderer_resources.h" type="rc_header">
diff --git a/chrome/renderer/resources/event_bindings.js b/chrome/renderer/resources/event_bindings.js
index ed097dc..6fcdd00 100644
--- a/chrome/renderer/resources/event_bindings.js
+++ b/chrome/renderer/resources/event_bindings.js
@@ -7,7 +7,7 @@
// have your change take effect.
// -----------------------------------------------------------------------------
-var chromium = chromium || {};
+var chrome = chrome || {};
(function () {
native function AttachEvent(eventName);
native function DetachEvent(eventName);
@@ -17,41 +17,41 @@ var chromium = chromium || {};
// with that name will route through this object's listeners.
//
// Example:
- // chromium.tabs.onTabChanged = new chromium.Event("tab-changed");
- // chromium.tabs.onTabChanged.addListener(function(data) { alert(data); });
- // chromium.Event.dispatch_("tab-changed", "hi");
+ // chrome.tabs.onChanged = new chrome.Event("tab-changed");
+ // chrome.tabs.onChanged.addListener(function(data) { alert(data); });
+ // chrome.Event.dispatch_("tab-changed", "hi");
// will result in an alert dialog that says 'hi'.
- chromium.Event = function(opt_eventName) {
+ chrome.Event = function(opt_eventName) {
this.eventName_ = opt_eventName;
this.listeners_ = [];
};
// A map of event names to the event object that is registered to that name.
- chromium.Event.attached_ = {};
+ chrome.Event.attached_ = {};
// Dispatches a named event with the given JSON array, which is deserialized
// before dispatch. The JSON array is the list of arguments that will be
// sent with the event callback.
- chromium.Event.dispatchJSON_ = function(name, args) {
- if (chromium.Event.attached_[name]) {
+ chrome.Event.dispatchJSON_ = function(name, args) {
+ if (chrome.Event.attached_[name]) {
if (args) {
args = goog.json.parse(args);
}
- chromium.Event.attached_[name].dispatch.apply(
- chromium.Event.attached_[name], args);
+ chrome.Event.attached_[name].dispatch.apply(
+ chrome.Event.attached_[name], args);
}
};
// Dispatches a named event with the given arguments, supplied as an array.
- chromium.Event.dispatch_ = function(name, args) {
- if (chromium.Event.attached_[name]) {
- chromium.Event.attached_[name].dispatch.apply(
- chromium.Event.attached_[name], args);
+ chrome.Event.dispatch_ = function(name, args) {
+ if (chrome.Event.attached_[name]) {
+ chrome.Event.attached_[name].dispatch.apply(
+ chrome.Event.attached_[name], args);
}
};
// Registers a callback to be called when this event is dispatched.
- chromium.Event.prototype.addListener = function(cb) {
+ chrome.Event.prototype.addListener = function(cb) {
this.listeners_.push(cb);
if (this.listeners_.length == 1) {
this.attach_();
@@ -59,7 +59,7 @@ var chromium = chromium || {};
};
// Unregisters a callback.
- chromium.Event.prototype.removeListener = function(cb) {
+ chrome.Event.prototype.removeListener = function(cb) {
var idx = this.findListener_(cb);
if (idx == -1) {
return;
@@ -72,13 +72,13 @@ var chromium = chromium || {};
};
// Test if the given callback is registered for this event.
- chromium.Event.prototype.hasListener = function(cb) {
+ chrome.Event.prototype.hasListener = function(cb) {
return this.findListeners_(cb) > -1;
};
// Returns the index of the given callback if registered, or -1 if not
// found.
- chromium.Event.prototype.findListener_ = function(cb) {
+ chrome.Event.prototype.findListener_ = function(cb) {
for (var i = 0; i < this.listeners_.length; i++) {
if (this.listeners_[i] == cb) {
return i;
@@ -90,7 +90,7 @@ var chromium = chromium || {};
// Dispatches this event object to all listeners, passing all supplied
// arguments to this function each listener.
- chromium.Event.prototype.dispatch = function(varargs) {
+ chrome.Event.prototype.dispatch = function(varargs) {
var args = Array.prototype.slice.call(arguments);
for (var i = 0; i < this.listeners_.length; i++) {
try {
@@ -103,33 +103,33 @@ var chromium = chromium || {};
// Attaches this event object to its name. Only one object can have a given
// name.
- chromium.Event.prototype.attach_ = function() {
+ chrome.Event.prototype.attach_ = function() {
AttachEvent(this.eventName_);
this.unloadHandler_ = this.detach_.bind(this);
window.addEventListener('unload', this.unloadHandler_, false);
if (!this.eventName_)
return;
- if (chromium.Event.attached_[this.eventName_]) {
- throw new Error("chromium.Event '" + this.eventName_ +
+ if (chrome.Event.attached_[this.eventName_]) {
+ throw new Error("chrome.Event '" + this.eventName_ +
"' is already attached.");
}
- chromium.Event.attached_[this.eventName_] = this;
+ chrome.Event.attached_[this.eventName_] = this;
};
// Detaches this event object from its name.
- chromium.Event.prototype.detach_ = function() {
+ chrome.Event.prototype.detach_ = function() {
window.removeEventListener('unload', this.unloadHandler_, false);
DetachEvent(this.eventName_);
if (!this.eventName_)
return;
- if (!chromium.Event.attached_[this.eventName_]) {
- throw new Error("chromium.Event '" + this.eventName_ +
+ if (!chrome.Event.attached_[this.eventName_]) {
+ throw new Error("chrome.Event '" + this.eventName_ +
"' is not attached.");
}
- delete chromium.Event.attached_[this.eventName_];
+ delete chrome.Event.attached_[this.eventName_];
};
})();
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js
index d1907d8..70df0fb 100644
--- a/chrome/renderer/resources/extension_process_bindings.js
+++ b/chrome/renderer/resources/extension_process_bindings.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The chrome Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,7 +7,7 @@
// have your change take effect.
// -----------------------------------------------------------------------------
-var chromium;
+var chrome;
(function() {
native function GetNextCallbackId();
native function GetWindow();
@@ -33,8 +33,8 @@ var chromium;
native function MoveBookmark();
native function SetBookmarkTitle();
- if (!chromium)
- chromium = {};
+ if (!chrome)
+ chrome = {};
// Validate arguments.
function validate(args, schemas) {
@@ -43,7 +43,7 @@ var chromium;
for (var i = 0; i < schemas.length; i++) {
if (i in args && args[i] !== null && args[i] !== undefined) {
- var validator = new chromium.JSONSchemaValidator();
+ var validator = new chrome.JSONSchemaValidator();
validator.validate(args[i], schemas[i]);
if (validator.errors.length == 0)
continue;
@@ -71,7 +71,7 @@ var chromium;
// TODO(aa): This function should not be publicly exposed. Pass it into V8
// instead and hold one per-context. See the way event_bindings.js works.
var callbacks = [];
- chromium.dispatchCallback_ = function(callbackId, str) {
+ chrome.dispatchCallback_ = function(callbackId, str) {
try {
if (str) {
callbacks[callbackId](goog.json.parse(str));
@@ -97,376 +97,376 @@ var chromium;
//----------------------------------------------------------------------------
// Windows.
- chromium.windows = {};
+ chrome.windows = {};
- chromium.windows.get = function(windowId, callback) {
+ chrome.windows.get = function(windowId, callback) {
validate(arguments, arguments.callee.params);
sendRequest(GetWindow, windowId, callback);
};
- chromium.windows.get.params = [
- chromium.types.pInt,
- chromium.types.fun
+ chrome.windows.get.params = [
+ chrome.types.pInt,
+ chrome.types.fun
];
- chromium.windows.getCurrent = function(callback) {
+ chrome.windows.getCurrent = function(callback) {
validate(arguments, arguments.callee.params);
sendRequest(GetCurrentWindow, null, callback);
};
- chromium.windows.getCurrent.params = [
- chromium.types.fun
+ chrome.windows.getCurrent.params = [
+ chrome.types.fun
];
- chromium.windows.getFocused = function(callback) {
+ chrome.windows.getFocused = function(callback) {
validate(arguments, arguments.callee.params);
sendRequest(GetFocusedWindow, null, callback);
};
- chromium.windows.getFocused.params = [
- chromium.types.fun
+ chrome.windows.getFocused.params = [
+ chrome.types.fun
];
- chromium.windows.getAll = function(populate, callback) {
+ chrome.windows.getAll = function(populate, callback) {
validate(arguments, arguments.callee.params);
sendRequest(GetAllWindows, populate, callback);
};
- chromium.windows.getAll.params = [
- chromium.types.optBool,
- chromium.types.fun
+ chrome.windows.getAll.params = [
+ chrome.types.optBool,
+ chrome.types.fun
];
- chromium.windows.createWindow = function(createData, callback) {
+ chrome.windows.createWindow = function(createData, callback) {
validate(arguments, arguments.callee.params);
sendRequest(CreateWindow, createData, callback);
};
- chromium.windows.createWindow.params = [
+ chrome.windows.createWindow.params = [
{
type: "object",
properties: {
- url: chromium.types.optStr,
- left: chromium.types.optInt,
- top: chromium.types.optInt,
- width: chromium.types.optPInt,
- height: chromium.types.optPInt
+ url: chrome.types.optStr,
+ left: chrome.types.optInt,
+ top: chrome.types.optInt,
+ width: chrome.types.optPInt,
+ height: chrome.types.optPInt
},
optional: true
},
- chromium.types.optFun
+ chrome.types.optFun
];
- chromium.windows.removeWindow = function(windowId, callback) {
+ chrome.windows.removeWindow = function(windowId, callback) {
validate(arguments, arguments.callee.params);
sendRequest(RemoveWindow, windowId, callback);
};
- chromium.windows.removeWindow.params = [
- chromium.types.pInt,
- chromium.types.optFun
+ chrome.windows.removeWindow.params = [
+ chrome.types.pInt,
+ chrome.types.optFun
];
// sends (windowId).
// *WILL* be followed by tab-attached AND then tab-selection-changed.
- chromium.windows.onCreated = new chromium.Event("window-created");
+ chrome.windows.onCreated = new chrome.Event("window-created");
// sends (windowId).
// *WILL* be preceded by sequences of tab-removed AND then
// tab-selection-changed -- one for each tab that was contained in the window
// that closed
- chromium.windows.onRemoved = new chromium.Event("window-removed");
+ chrome.windows.onRemoved = new chrome.Event("window-removed");
// sends (windowId).
- chromium.windows.onFocusChanged =
- new chromium.Event("window-focus-changed");
+ chrome.windows.onFocusChanged =
+ new chrome.Event("window-focus-changed");
//----------------------------------------------------------------------------
// Tabs
- chromium.tabs = {};
+ chrome.tabs = {};
- chromium.tabs.get = function(tabId, callback) {
+ chrome.tabs.get = function(tabId, callback) {
validate(arguments, arguments.callee.params);
sendRequest(GetTab, tabId, callback);
};
- chromium.tabs.get.params = [
- chromium.types.pInt,
- chromium.types.fun
+ chrome.tabs.get.params = [
+ chrome.types.pInt,
+ chrome.types.fun
];
- chromium.tabs.getSelected = function(windowId, callback) {
+ chrome.tabs.getSelected = function(windowId, callback) {
validate(arguments, arguments.callee.params);
sendRequest(GetSelectedTab, windowId, callback);
};
- chromium.tabs.getSelected.params = [
- chromium.types.optPInt,
- chromium.types.fun
+ chrome.tabs.getSelected.params = [
+ chrome.types.optPInt,
+ chrome.types.fun
];
- chromium.tabs.getAllInWindow = function(windowId, callback) {
+ chrome.tabs.getAllInWindow = function(windowId, callback) {
validate(arguments, arguments.callee.params);
sendRequest(GetAllTabsInWindow, windowId, callback);
};
- chromium.tabs.getAllInWindow.params = [
- chromium.types.optPInt,
- chromium.types.fun
+ chrome.tabs.getAllInWindow.params = [
+ chrome.types.optPInt,
+ chrome.types.fun
];
- chromium.tabs.create = function(tab, callback) {
+ chrome.tabs.create = function(tab, callback) {
validate(arguments, arguments.callee.params);
sendRequest(CreateTab, tab, callback);
};
- chromium.tabs.create.params = [
+ chrome.tabs.create.params = [
{
type: "object",
properties: {
- windowId: chromium.types.optPInt,
- index: chromium.types.optPInt,
- url: chromium.types.optStr,
- selected: chromium.types.optBool
+ windowId: chrome.types.optPInt,
+ index: chrome.types.optPInt,
+ url: chrome.types.optStr,
+ selected: chrome.types.optBool
}
},
- chromium.types.optFun
+ chrome.types.optFun
];
- chromium.tabs.update = function(tabId, updates, callback) {
+ chrome.tabs.update = function(tabId, updates, callback) {
validate(arguments, arguments.callee.params);
sendRequest(UpdateTab, [tabId, updates], callback);
};
- chromium.tabs.update.params = [
- chromium.types.pInt,
+ chrome.tabs.update.params = [
+ chrome.types.pInt,
{
type: "object",
properties: {
- url: chromium.types.optStr,
- selected: chromium.types.optBool
+ url: chrome.types.optStr,
+ selected: chrome.types.optBool
}
},
- chromium.types.optFun
+ chrome.types.optFun
];
- chromium.tabs.move = function(tabId, moveProps, callback) {
+ chrome.tabs.move = function(tabId, moveProps, callback) {
validate(arguments, arguments.callee.params);
sendRequest(MoveTab, [tabId, moveProps], callback);
};
- chromium.tabs.move.params = [
- chromium.types.pInt,
+ chrome.tabs.move.params = [
+ chrome.types.pInt,
{
type: "object",
properties: {
- windowId: chromium.types.optPInt,
- index: chromium.types.pInt
+ windowId: chrome.types.optPInt,
+ index: chrome.types.pInt
}
},
- chromium.types.optFun
+ chrome.types.optFun
];
- chromium.tabs.remove = function(tabId) {
+ chrome.tabs.remove = function(tabId) {
validate(arguments, arguments.callee.params);
sendRequest(RemoveTab, tabId);
};
- chromium.tabs.remove.params = [
- chromium.types.pInt
+ chrome.tabs.remove.params = [
+ chrome.types.pInt
];
// Sends ({Tab}).
// Will *NOT* be followed by tab-attached - it is implied.
// *MAY* be followed by tab-selection-changed.
- chromium.tabs.onCreated = new chromium.Event("tab-created");
+ chrome.tabs.onCreated = new chrome.Event("tab-created");
// Sends (tabId, {windowId, fromIndex, toIndex}).
// Tabs can only "move" within a window.
- chromium.tabs.onMoved = new chromium.Event("tab-moved");
+ chrome.tabs.onMoved = new chrome.Event("tab-moved");
// Sends (tabId, {windowId}).
- chromium.tabs.onSelectionChanged =
- new chromium.Event("tab-selection-changed");
+ chrome.tabs.onSelectionChanged =
+ new chrome.Event("tab-selection-changed");
// Sends (tabId, {newWindowId, newPosition}).
// *MAY* be followed by tab-selection-changed.
- chromium.tabs.onAttached = new chromium.Event("tab-attached");
+ chrome.tabs.onAttached = new chrome.Event("tab-attached");
// Sends (tabId, {oldWindowId, oldPosition}).
// *WILL* be followed by tab-selection-changed.
- chromium.tabs.onDetached = new chromium.Event("tab-detached");
+ chrome.tabs.onDetached = new chrome.Event("tab-detached");
// Sends (tabId).
// *WILL* be followed by tab-selection-changed.
// Will *NOT* be followed or preceded by tab-detached.
- chromium.tabs.onRemoved = new chromium.Event("tab-removed");
+ chrome.tabs.onRemoved = new chrome.Event("tab-removed");
//----------------------------------------------------------------------------
// PageActions.
- chromium.pageActions = {};
+ chrome.pageActions = {};
- chromium.pageActions.enableForTab = function(pageActionId, action) {
+ chrome.pageActions.enableForTab = function(pageActionId, action) {
validate(arguments, arguments.callee.params);
sendRequest(EnablePageAction, [pageActionId, action]);
}
- chromium.pageActions.enableForTab.params = [
- chromium.types.str,
+ chrome.pageActions.enableForTab.params = [
+ chrome.types.str,
{
type: "object",
properties: {
- tabId: chromium.types.pInt,
- url: chromium.types.str
+ tabId: chrome.types.pInt,
+ url: chrome.types.str
},
optional: false
}
];
// Sends ({pageActionId, tabId, tabUrl}).
- chromium.pageActions.onExecute =
- new chromium.Event("page-action-executed");
+ chrome.pageActions.onExecute =
+ new chrome.Event("page-action-executed");
//----------------------------------------------------------------------------
// Bookmarks
- chromium.bookmarks = {};
+ chrome.bookmarks = {};
- chromium.bookmarks.get = function(ids, callback) {
+ chrome.bookmarks.get = function(ids, callback) {
validate(arguments, arguments.callee.params);
sendRequest(GetBookmarks, ids, callback);
};
- chromium.bookmarks.get.params = [
+ chrome.bookmarks.get.params = [
{
type: "array",
- items: chromium.types.pInt,
+ items: chrome.types.pInt,
optional: true
},
- chromium.types.fun
+ chrome.types.fun
];
- chromium.bookmarks.getChildren = function(id, callback) {
+ chrome.bookmarks.getChildren = function(id, callback) {
validate(arguments, arguments.callee.params);
sendRequest(GetBookmarkChildren, id, callback);
};
- chromium.bookmarks.getChildren.params = [
- chromium.types.pInt,
- chromium.types.fun
+ chrome.bookmarks.getChildren.params = [
+ chrome.types.pInt,
+ chrome.types.fun
];
- chromium.bookmarks.getTree = function(callback) {
+ chrome.bookmarks.getTree = function(callback) {
validate(arguments, arguments.callee.params);
sendRequest(GetBookmarkTree, null, callback);
};
// TODO(erikkay): allow it to take an optional id as a starting point
- chromium.bookmarks.getTree.params = [
- chromium.types.fun
+ chrome.bookmarks.getTree.params = [
+ chrome.types.fun
];
- chromium.bookmarks.search = function(query, callback) {
+ chrome.bookmarks.search = function(query, callback) {
validate(arguments, arguments.callee.params);
sendRequest(SearchBookmarks, query, callback);
};
- chromium.bookmarks.search.params = [
- chromium.types.str,
- chromium.types.fun
+ chrome.bookmarks.search.params = [
+ chrome.types.str,
+ chrome.types.fun
];
- chromium.bookmarks.remove = function(bookmark, callback) {
+ chrome.bookmarks.remove = function(bookmark, callback) {
validate(arguments, arguments.callee.params);
sendRequest(RemoveBookmark, bookmark, callback);
};
- chromium.bookmarks.remove.params = [
+ chrome.bookmarks.remove.params = [
{
type: "object",
properties: {
- id: chromium.types.pInt,
- recursive: chromium.types.optBool
+ id: chrome.types.pInt,
+ recursive: chrome.types.optBool
}
},
- chromium.types.optFun
+ chrome.types.optFun
];
- chromium.bookmarks.create = function(bookmark, callback) {
+ chrome.bookmarks.create = function(bookmark, callback) {
validate(arguments, arguments.callee.params);
sendRequest(CreateBookmark, bookmark, callback);
};
- chromium.bookmarks.create.params = [
+ chrome.bookmarks.create.params = [
{
type: "object",
properties: {
- parentId: chromium.types.optPInt,
- index: chromium.types.optPInt,
- title: chromium.types.optStr,
- url: chromium.types.optStr,
+ parentId: chrome.types.optPInt,
+ index: chrome.types.optPInt,
+ title: chrome.types.optStr,
+ url: chrome.types.optStr,
}
},
- chromium.types.optFun
+ chrome.types.optFun
];
- chromium.bookmarks.move = function(obj, callback) {
+ chrome.bookmarks.move = function(obj, callback) {
validate(arguments, arguments.callee.params);
sendRequest(MoveBookmark, obj, callback);
};
- chromium.bookmarks.move.params = [
+ chrome.bookmarks.move.params = [
{
type: "object",
properties: {
- id: chromium.types.pInt,
- parentId: chromium.types.optPInt,
- index: chromium.types.optPInt
+ id: chrome.types.pInt,
+ parentId: chrome.types.optPInt,
+ index: chrome.types.optPInt
}
},
- chromium.types.optFun
+ chrome.types.optFun
];
- chromium.bookmarks.setTitle = function(bookmark, callback) {
+ chrome.bookmarks.setTitle = function(bookmark, callback) {
validate(arguments, arguments.callee.params);
sendRequest(SetBookmarkTitle, bookmark, callback);
};
- chromium.bookmarks.setTitle.params = [
+ chrome.bookmarks.setTitle.params = [
{
type: "object",
properties: {
- id: chromium.types.pInt,
- title: chromium.types.optStr
+ id: chrome.types.pInt,
+ title: chrome.types.optStr
}
},
- chromium.types.optFun
+ chrome.types.optFun
];
// bookmark events
// Sends ({id, title, url, parentId, index})
- chromium.bookmarks.onBookmarkAdded = new chromium.Event("bookmark-added");
+ chrome.bookmarks.onBookmarkAdded = new chrome.Event("bookmark-added");
// Sends ({parentId, index})
- chromium.bookmarks.onBookmarkRemoved = new chromium.Event("bookmark-removed");
+ chrome.bookmarks.onBookmarkRemoved = new chrome.Event("bookmark-removed");
// Sends (id, object) where object has list of properties that have changed.
// Currently, this only ever includes 'title'.
- chromium.bookmarks.onBookmarkChanged = new chromium.Event("bookmark-changed");
+ chrome.bookmarks.onBookmarkChanged = new chrome.Event("bookmark-changed");
// Sends ({id, parentId, index, oldParentId, oldIndex})
- chromium.bookmarks.onBookmarkMoved = new chromium.Event("bookmark-moved");
+ chrome.bookmarks.onBookmarkMoved = new chrome.Event("bookmark-moved");
// Sends (id, [childrenIds])
- chromium.bookmarks.onBookmarkChildrenReordered =
- new chromium.Event("bookmark-children-reordered");
+ chrome.bookmarks.onBookmarkChildrenReordered =
+ new chrome.Event("bookmark-children-reordered");
//----------------------------------------------------------------------------
// Self.
- chromium.self = {};
- chromium.self.onConnect = new chromium.Event("channel-connect");
+ chrome.self = {};
+ chrome.self.onConnect = new chrome.Event("channel-connect");
})();
diff --git a/chrome/renderer/resources/json_schema.js b/chrome/renderer/resources/json_schema.js
index 5fdbd8c..f8a4c7a 100755
--- a/chrome/renderer/resources/json_schema.js
+++ b/chrome/renderer/resources/json_schema.js
@@ -36,12 +36,12 @@
// - made additionalProperties default to false
//==============================================================================
-var chromium = chromium || {};
+var chrome = chrome || {};
/**
* Validates an instance against a schema and accumulates errors. Usage:
*
- * var validator = new chromium.JSONSchemaValidator();
+ * var validator = new chrome.JSONSchemaValidator();
* validator.validate(inst, schema);
* if (validator.errors.length == 0)
* console.log("Valid!");
@@ -53,11 +53,11 @@ var chromium = chromium || {};
* the key that had the problem, and the "message" property contains a sentence
* describing the error.
*/
-chromium.JSONSchemaValidator = function() {
+chrome.JSONSchemaValidator = function() {
this.errors = [];
};
-chromium.JSONSchemaValidator.messages = {
+chrome.JSONSchemaValidator.messages = {
invalidEnum: "Value must be one of: [*].",
propertyRequired: "Property is required.",
unexpectedProperty: "Unexpected property.",
@@ -80,7 +80,7 @@ chromium.JSONSchemaValidator.messages = {
* Builds an error message. Key is the property in the |errors| object, and
* |opt_replacements| is an array of values to replace "*" characters with.
*/
-chromium.JSONSchemaValidator.formatError = function(key, opt_replacements) {
+chrome.JSONSchemaValidator.formatError = function(key, opt_replacements) {
var message = this.messages[key];
if (opt_replacements) {
for (var i = 0; i < opt_replacements.length; i++) {
@@ -95,7 +95,7 @@ chromium.JSONSchemaValidator.formatError = function(key, opt_replacements) {
* don't explicitly disallow 'function', because we want to allow functions in
* the input values.
*/
-chromium.JSONSchemaValidator.getType = function(value) {
+chrome.JSONSchemaValidator.getType = function(value) {
var s = typeof value;
if (s == "object") {
@@ -119,8 +119,8 @@ chromium.JSONSchemaValidator.getType = function(value) {
* value and will be validated recursively. When this method returns, the
* |errors| property will contain a list of errors, if any.
*/
-chromium.JSONSchemaValidator.prototype.validate = function(instance, schema,
- opt_path) {
+chrome.JSONSchemaValidator.prototype.validate = function(instance, schema,
+ opt_path) {
var path = opt_path || "";
if (!schema) {
@@ -174,9 +174,9 @@ chromium.JSONSchemaValidator.prototype.validate = function(instance, schema,
* Validates an instance against a choices schema. The instance must match at
* least one of the provided choices.
*/
-chromium.JSONSchemaValidator.prototype.validateChoices = function(instance,
- schema,
- path) {
+chrome.JSONSchemaValidator.prototype.validateChoices = function(instance,
+ schema,
+ path) {
var originalErrors = this.errors;
for (var i = 0; i < schema.choices.length; i++) {
@@ -197,8 +197,8 @@ chromium.JSONSchemaValidator.prototype.validateChoices = function(instance,
* |errors| property, and returns a boolean indicating whether the instance
* validates.
*/
-chromium.JSONSchemaValidator.prototype.validateEnum = function(instance, schema,
- path) {
+chrome.JSONSchemaValidator.prototype.validateEnum = function(instance, schema,
+ path) {
for (var i = 0; i < schema.enum.length; i++) {
if (instance === schema.enum[i])
return true;
@@ -212,8 +212,8 @@ chromium.JSONSchemaValidator.prototype.validateEnum = function(instance, schema,
* Validates an instance against an object schema and populates the errors
* property.
*/
-chromium.JSONSchemaValidator.prototype.validateObject = function(instance,
- schema, path) {
+chrome.JSONSchemaValidator.prototype.validateObject = function(instance,
+ schema, path) {
for (var prop in schema.properties) {
var propPath = path ? path + "." + prop : prop;
if (schema.properties[prop] == undefined) {
@@ -245,9 +245,9 @@ chromium.JSONSchemaValidator.prototype.validateObject = function(instance,
* Validates an instance against an array schema and populates the errors
* property.
*/
-chromium.JSONSchemaValidator.prototype.validateArray = function(instance,
- schema, path) {
- var typeOfItems = chromium.JSONSchemaValidator.getType(schema.items);
+chrome.JSONSchemaValidator.prototype.validateArray = function(instance,
+ schema, path) {
+ var typeOfItems = chrome.JSONSchemaValidator.getType(schema.items);
if (typeOfItems == 'object') {
if (schema.minItems && instance.length < schema.minItems) {
@@ -292,8 +292,8 @@ chromium.JSONSchemaValidator.prototype.validateArray = function(instance,
/**
* Validates a string and populates the errors property.
*/
-chromium.JSONSchemaValidator.prototype.validateString = function(instance,
- schema, path) {
+chrome.JSONSchemaValidator.prototype.validateString = function(instance,
+ schema, path) {
if (schema.minLength && instance.length < schema.minLength)
this.addError(path, "stringMinLength", [schema.minLength]);
@@ -308,8 +308,8 @@ chromium.JSONSchemaValidator.prototype.validateString = function(instance,
* Validates a number and populates the errors property. The instance is
* assumed to be a number.
*/
-chromium.JSONSchemaValidator.prototype.validateNumber = function(instance,
- schema, path) {
+chrome.JSONSchemaValidator.prototype.validateNumber = function(instance,
+ schema, path) {
if (schema.minimum && instance < schema.minimum)
this.addError(path, "numberMinValue", [schema.minimum]);
@@ -324,9 +324,9 @@ chromium.JSONSchemaValidator.prototype.validateNumber = function(instance,
* Validates the primitive type of an instance and populates the errors
* property. Returns true if the instance validates, false otherwise.
*/
-chromium.JSONSchemaValidator.prototype.validateType = function(instance, schema,
- path) {
- var actualType = chromium.JSONSchemaValidator.getType(instance);
+chrome.JSONSchemaValidator.prototype.validateType = function(instance, schema,
+ path) {
+ var actualType = chrome.JSONSchemaValidator.getType(instance);
if (schema.type != actualType && !(schema.type == "number" &&
actualType == "integer")) {
this.addError(path, "invalidType", [schema.type, actualType]);
@@ -341,15 +341,15 @@ chromium.JSONSchemaValidator.prototype.validateType = function(instance, schema,
* |replacements| is an array of values to replace '*' characters in the
* message.
*/
-chromium.JSONSchemaValidator.prototype.addError = function(path, key,
- replacements) {
+chrome.JSONSchemaValidator.prototype.addError = function(path, key,
+ replacements) {
this.errors.push({
path: path,
- message: chromium.JSONSchemaValidator.formatError(key, replacements)
+ message: chrome.JSONSchemaValidator.formatError(key, replacements)
});
};
-// Set up chromium.types with some commonly used types...
+// Set up chrome.types with some commonly used types...
(function() {
function extend(base, ext) {
var result = {};
@@ -381,5 +381,5 @@ chromium.JSONSchemaValidator.prototype.addError = function(path, key,
};
};
- chromium.types = types;
+ chrome.types = types;
})();
diff --git a/chrome/renderer/resources/renderer_extension_bindings.js b/chrome/renderer/resources/renderer_extension_bindings.js
index 11494e3..667b97d 100644
--- a/chrome/renderer/resources/renderer_extension_bindings.js
+++ b/chrome/renderer/resources/renderer_extension_bindings.js
@@ -7,41 +7,41 @@
// have your change take effect.
// -----------------------------------------------------------------------------
-var chromium = chromium || {};
+var chrome = chrome || {};
(function () {
native function OpenChannelToExtension(id);
native function PostMessage(portId, msg);
// Port object. Represents a connection to another script context through
// which messages can be passed.
- chromium.Port = function(portId) {
- if (chromium.Port.ports_[portId]) {
+ chrome.Port = function(portId) {
+ if (chrome.Port.ports_[portId]) {
throw new Error("Port '" + portId + "' already exists.");
}
this.portId_ = portId; // TODO(mpcomplete): readonly
- this.onMessage = new chromium.Event();
- chromium.Port.ports_[portId] = this;
+ this.onMessage = new chrome.Event();
+ chrome.Port.ports_[portId] = this;
// Note: this object will never get GCed. If we ever care, we could
// add an "ondetach" method to the onMessage Event that gets called
// when there are no more listeners.
};
// Map of port IDs to port object.
- chromium.Port.ports_ = {};
+ chrome.Port.ports_ = {};
// Called by native code when a channel has been opened to this context.
- chromium.Port.dispatchOnConnect_ = function(portId, tab) {
- var port = new chromium.Port(portId);
+ chrome.Port.dispatchOnConnect_ = function(portId, tab) {
+ var port = new chrome.Port(portId);
if (tab) {
tab = goog.json.parse(tab);
}
port.tab = tab;
- chromium.Event.dispatch_("channel-connect", [port]);
+ chrome.Event.dispatch_("channel-connect", [port]);
};
// Called by native code when a message has been sent to the given port.
- chromium.Port.dispatchOnMessage_ = function(msg, portId) {
- var port = chromium.Port.ports_[portId];
+ chrome.Port.dispatchOnMessage_ = function(msg, portId) {
+ var port = chrome.Port.ports_[portId];
if (port) {
if (msg) {
msg = goog.json.parse(msg);
@@ -52,27 +52,27 @@ var chromium = chromium || {};
// Sends a message asynchronously to the context on the other end of this
// port.
- chromium.Port.prototype.postMessage = function(msg) {
+ chrome.Port.prototype.postMessage = function(msg) {
PostMessage(this.portId_, goog.json.serialize(msg));
};
// Extension object.
- chromium.Extension = function(id) {
+ chrome.Extension = function(id) {
this.id_ = id;
};
// Opens a message channel to the extension. Returns a Port for
// message passing.
- chromium.Extension.prototype.connect = function() {
+ chrome.Extension.prototype.connect = function() {
var portId = OpenChannelToExtension(this.id_);
if (portId == -1)
throw new Error("No such extension: '" + this.id_ + "'");
- return new chromium.Port(portId);
+ return new chrome.Port(portId);
};
// Returns a resource URL that can be used to fetch a resource from this
// extension.
- chromium.Extension.prototype.getURL = function(path) {
+ chrome.Extension.prototype.getURL = function(path) {
return "chrome-extension://" + this.id_ + "/" + path;
};
})();
diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc
index 80eba6c..4f44ef9 100644
--- a/chrome/renderer/user_script_slave.cc
+++ b/chrome/renderer/user_script_slave.cc
@@ -27,7 +27,7 @@ static const char kUserScriptTail[] = "\n})(window);";
// Creates a convenient reference to a content script's parent extension.
static const char kInitExtension[] =
- "chromium.extension = new chromium.Extension('%s')";
+ "chrome.extension = new chrome.Extension('%s')";
UserScriptSlave::UserScriptSlave()
: shared_memory_(NULL),
@@ -151,7 +151,7 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame,
sources.insert(sources.begin(),
WebScriptSource(WebString::fromUTF8(api_js_.as_string())));
} else {
- // Setup chromium.self to contain an Extension object with the correct
+ // Setup chrome.self to contain an Extension object with the correct
// ID.
sources.insert(sources.begin(),
WebScriptSource(WebString::fromUTF8(
diff --git a/chrome/test/data/extensions/json_schema_test.js b/chrome/test/data/extensions/json_schema_test.js
index caf494a..195dcba 100755
--- a/chrome/test/data/extensions/json_schema_test.js
+++ b/chrome/test/data/extensions/json_schema_test.js
@@ -8,7 +8,7 @@ function assert(truth) {
}
function assertValid(type, instance, schema) {
- var validator = new chromium.JSONSchemaValidator();
+ var validator = new chrome.JSONSchemaValidator();
validator["validate" + type](instance, schema, "");
if (validator.errors.length != 0) {
log("Got unexpected errors");
@@ -18,7 +18,7 @@ function assertValid(type, instance, schema) {
}
function assertNotValid(type, instance, schema, errors) {
- var validator = new chromium.JSONSchemaValidator();
+ var validator = new chrome.JSONSchemaValidator();
validator["validate" + type](instance, schema, "");
assert(validator.errors.length === errors.length);
for (var i = 0; i < errors.length; i++) {
@@ -34,7 +34,7 @@ function assertNotValid(type, instance, schema, errors) {
}
function formatError(key, replacements) {
- return chromium.JSONSchemaValidator.formatError(key, replacements);
+ return chrome.JSONSchemaValidator.formatError(key, replacements);
}
function testFormatError() {
diff --git a/chrome/test/data/extensions/samples/bookmarks/bookmark_api.html b/chrome/test/data/extensions/samples/bookmarks/bookmark_api.html
index 89641ab..4005ddc 100644
--- a/chrome/test/data/extensions/samples/bookmarks/bookmark_api.html
+++ b/chrome/test/data/extensions/samples/bookmarks/bookmark_api.html
@@ -34,11 +34,11 @@ var testMoveBookmarks2 = function(event) {
return;
}
console.log("testMoveBookmarks2");
- chromium.bookmarks.get([], function(root) {
+ chrome.bookmarks.get([], function(root) {
console.log("1");
- chromium.bookmarks.get(root[0].childrenIds, function(root_children) {
+ chrome.bookmarks.get(root[0].childrenIds, function(root_children) {
var bookmark_bar = root_children[0]; // bookmarks bar is always first
- chromium.bookmarks.get(bookmark_bar.childrenIds,
+ chrome.bookmarks.get(bookmark_bar.childrenIds,
function(bar_children) {
var folder_search = [];
bar_children.forEach(function(child) {
@@ -50,18 +50,18 @@ var testMoveBookmarks2 = function(event) {
console.log('moving children out of "folder"');
var folder = folder_search[0];
folder.childrenIds.forEach(function(folder_child_id) {
- chromium.bookmarks.move({'id': folder_child_id,
+ chrome.bookmarks.move({'id': folder_child_id,
'parentId': bookmark_bar.id});
});
- chromium.bookmarks.remove({'id': folder.id});
+ chrome.bookmarks.remove({'id': folder.id});
} else if (folder_search.length == 0) {
console.log('creating "folder" and moving children into it');
- chromium.bookmarks.create({'parentId': bookmark_bar.id,
+ chrome.bookmarks.create({'parentId': bookmark_bar.id,
'title': 'folder'},
function(folder) {
- chromium.bookmarks.search("oog", function(oog_search) {
+ chrome.bookmarks.search("oog", function(oog_search) {
oog_search.forEach(function(oog_match) {
- chromium.bookmarks.move({'id': oog_match.id,
+ chrome.bookmarks.move({'id': oog_match.id,
'parentId': folder.id})
});
});
diff --git a/chrome/test/data/extensions/samples/bookmarks/bookmark_view.html b/chrome/test/data/extensions/samples/bookmarks/bookmark_view.html
index 5b9b064..b629852 100644
--- a/chrome/test/data/extensions/samples/bookmarks/bookmark_view.html
+++ b/chrome/test/data/extensions/samples/bookmarks/bookmark_view.html
@@ -29,7 +29,7 @@
// code that sets up our v8 extensions, and we don't end up with them running.
//
// If we noticed this happened, reload ourselves, which should fix it.
-if (!chromium.bookmarks)
+if (!chrome.bookmarks)
location.reload();
var logEvent = function(name, data) {
@@ -38,23 +38,23 @@ var logEvent = function(name, data) {
console.log("got event: " + name);
}
-chromium.bookmarks.onBookmarkAdded.addListener(function(data) {
+chrome.bookmarks.onBookmarkAdded.addListener(function(data) {
logEvent("onBookmarkAdded", data);
});
-chromium.bookmarks.onBookmarkRemoved.addListener(function(data) {
+chrome.bookmarks.onBookmarkRemoved.addListener(function(data) {
logEvent("onBookmarkRemoved", data);
});
-chromium.bookmarks.onBookmarkChanged.addListener(function(data) {
+chrome.bookmarks.onBookmarkChanged.addListener(function(data) {
logEvent("onBookmarkChanged", data);
});
-chromium.bookmarks.onBookmarkMoved.addListener(function(data) {
+chrome.bookmarks.onBookmarkMoved.addListener(function(data) {
logEvent("onBookmarkMoved", data);
});
-chromium.bookmarks.onBookmarkChildrenReordered.addListener(function(data) {
+chrome.bookmarks.onBookmarkChildrenReordered.addListener(function(data) {
logEvent("onBookmarkChildrenReordered", data);
});
@@ -71,7 +71,7 @@ var toggleBookmark = function(event) {
return;
console.log("toggle: " + id);
//console.dir(event);
- chromium.bookmarks.get([id], function(bookmark) {
+ chrome.bookmarks.get([id], function(bookmark) {
//console.log("toggle get");
console.dir(bookmark[0]);
if (bookmark[0].childrenIds && bookmark[0].childrenIds.length) {
@@ -80,7 +80,7 @@ var toggleBookmark = function(event) {
node.removeChild(node.childNodes[1]);
} else {
//console.log("before");
- chromium.bookmarks.get(bookmark[0].childrenIds, function(children) {
+ chrome.bookmarks.get(bookmark[0].childrenIds, function(children) {
//console.log("toggle expand");
if (children && children.length) {
console.dir(children);
@@ -122,14 +122,14 @@ var addBookmarks = function(bookmarks, parent) {
var loadBookmarks = function() {
var container = document.getElementById('container');
- chromium.bookmarks.get([], function(results) {
+ chrome.bookmarks.get([], function(results) {
var root = results[0];
console.dir(root);
var rootElement = document.createElement("div");
rootElement.id = prefix + root.id;
// root element is empty / invisible, just an id to be looked up
container.appendChild(rootElement);
- chromium.bookmarks.get(root.childrenIds, function(children) {
+ chrome.bookmarks.get(root.childrenIds, function(children) {
addBookmarks(children, rootElement);
});
});
diff --git a/chrome/test/data/extensions/samples/gmail/gmail_checker.html b/chrome/test/data/extensions/samples/gmail/gmail_checker.html
index f754ad7..7f729b1 100644
--- a/chrome/test/data/extensions/samples/gmail/gmail_checker.html
+++ b/chrome/test/data/extensions/samples/gmail/gmail_checker.html
@@ -86,7 +86,7 @@ function requestUnreadFeed() {
}
function goToInbox() {
- chromium.tabs.create({url:"http://www.gmail.com/"});
+ chrome.tabs.create({url:"http://www.gmail.com/"});
}
</script>
diff --git a/chrome/test/data/extensions/samples/subscribe/toolstrip.html b/chrome/test/data/extensions/samples/subscribe/toolstrip.html
index cc6ca3a..c2355a6 100644
--- a/chrome/test/data/extensions/samples/subscribe/toolstrip.html
+++ b/chrome/test/data/extensions/samples/subscribe/toolstrip.html
@@ -11,7 +11,7 @@
button.onclick = handleClick;
- chromium.self.onConnect.addListener(function(port) {
+ chrome.self.onConnect.addListener(function(port) {
port.onMessage.addListener(function(feedUrls) {
// TODO(aa): When we have the ability to display drop downs, we should let
// the user pick which feed to subscribe. Right now, we just pick the
@@ -45,7 +45,7 @@
function handleClick() {
if (enabled) {
var url = "http://www.google.com/reader/view/feed/" + feedUrl;
- chromium.tabs.create({url: url});
+ chrome.tabs.create({url: url});
}
}
</script>
diff --git a/chrome/test/data/extensions/samples/tabs/tabs_api.html b/chrome/test/data/extensions/samples/tabs/tabs_api.html
index abcf802..af4a735 100644
--- a/chrome/test/data/extensions/samples/tabs/tabs_api.html
+++ b/chrome/test/data/extensions/samples/tabs/tabs_api.html
@@ -10,9 +10,9 @@ focusedWindowId = undefined;
currentWindowId = undefined;
function bootStrap() {
- chromium.windows.getCurrent(function(currentWindow) {
+ chrome.windows.getCurrent(function(currentWindow) {
currentWindowId = currentWindow.id;
- chromium.windows.getFocused(function(focusedWindow) {
+ chrome.windows.getFocused(function(focusedWindow) {
focusedWindowId = focusedWindow.id;
loadWindowList();
});
@@ -20,7 +20,7 @@ function bootStrap() {
}
function loadWindowList() {
- chromium.windows.getAll(true, function(windowList) {
+ chrome.windows.getAll(true, function(windowList) {
tabs = {};
tabIds = [];
for (var i = 0; i < windowList.length; i++) {
@@ -50,7 +50,7 @@ function updateTabData(id) {
function updateTab(id){
try {
- chromium.tabs.update(id, updateTabData(id));
+ chrome.tabs.update(id, updateTabData(id));
} catch (e) {
alert(e);
}
@@ -65,7 +65,7 @@ function moveTabData(id) {
}
function moveTab(id) {
try {
- chromium.tabs.move(id, moveTabData(id));
+ chrome.tabs.move(id, moveTabData(id));
} catch (e) {
alert(e);
}
@@ -89,7 +89,7 @@ function createTab() {
delete args.index;
try {
- chromium.tabs.create(args);
+ chrome.tabs.create(args);
} catch (e) {
alert(e);
}
@@ -98,7 +98,7 @@ function createTab() {
function updateAll() {
try {
for (var i = 0; i < tabIds.length; i++) {
- chromium.tabs.update(tabIds[i], updateTabData(tabIds[i]));
+ chrome.tabs.update(tabIds[i], updateTabData(tabIds[i]));
}
} catch(e) {
alert(e);
@@ -109,7 +109,7 @@ function moveAll() {
appendToLog('moving all');
try {
for (var i = 0; i < tabIds.length; i++) {
- chromium.tabs.move(tabIds[i], moveTabData(tabIds[i]));
+ chrome.tabs.move(tabIds[i], moveTabData(tabIds[i]));
}
} catch(e) {
alert(e);
@@ -125,48 +125,48 @@ function clearLog() {
document.getElementById('log').innerHTML = '';
}
-chromium.windows.onCreated.addListener(function(windowId) {
+chrome.windows.onCreated.addListener(function(windowId) {
appendToLog('windows.onCreated -- window: ' + windowId);
loadWindowList();
});
-chromium.windows.onFocusChanged.addListener(function(windowId) {
+chrome.windows.onFocusChanged.addListener(function(windowId) {
focusedWindowId = windowId;
appendToLog('windows.onFocusChanged -- window: ' + windowId);
loadWindowList();
});
-chromium.windows.onRemoved.addListener(function(windowId) {
+chrome.windows.onRemoved.addListener(function(windowId) {
appendToLog('windows.onRemoved -- window: ' + windowId);
loadWindowList();
});
-chromium.tabs.onCreated.addListener(function(tab) {
+chrome.tabs.onCreated.addListener(function(tab) {
appendToLog('tabs.onCreated -- window: ' + tab.windowId + ' tab: ' + tab.id + ' index ' + tab.index + ' url ' + tab.url);
loadWindowList();
});
-chromium.tabs.onAttached.addListener(function(tabId, props) {
+chrome.tabs.onAttached.addListener(function(tabId, props) {
appendToLog('tabs.onAttached -- window: ' + props.newWindowId + ' tab: ' + tabId + ' index ' + props.newPosition);
loadWindowList();
});
-chromium.tabs.onMoved.addListener(function(tabId, props) {
+chrome.tabs.onMoved.addListener(function(tabId, props) {
appendToLog('tabs.onMoved -- window: ' + props.windowId + ' tab: ' + tabId + ' from ' + props.fromIndex + ' to ' + props.toIndex);
loadWindowList();
});
-chromium.tabs.onDetached.addListener(function(tabId, props) {
+chrome.tabs.onDetached.addListener(function(tabId, props) {
appendToLog('tabs.onDetached -- window: ' + props.oldWindowId + ' tab: ' + tabId + ' index ' + props.oldPosition);
loadWindowList();
});
-chromium.tabs.onSelectionChanged.addListener(function(tabId, props) {
+chrome.tabs.onSelectionChanged.addListener(function(tabId, props) {
appendToLog('tabs.onSelectionChanged -- window: ' + props.windowId + ' tab: ' + tabId);
loadWindowList();
});
-chromium.tabs.onRemoved.addListener(function(tabId) {
+chrome.tabs.onRemoved.addListener(function(tabId) {
appendToLog('tabs.onRemoved -- tab: ' + tabId);
loadWindowList();
});
@@ -196,15 +196,15 @@ function createWindow() {
delete args.url;
try {
- chromium.windows.createWindow(args);
+ chrome.windows.createWindow(args);
} catch(e) {
alert(e);
}
}
function refreshWindow(windowId) {
- chromium.windows.get(windowId, function(window) {
- chromium.tabs.getAllInWindow(window.id, function(tabList) {
+ chrome.windows.get(windowId, function(window) {
+ chrome.tabs.getAllInWindow(window.id, function(tabList) {
window.tabs = tabList;
var input = new JsExprContext(window);
var output = document.getElementById('window_' + window.id);
@@ -216,7 +216,7 @@ function refreshWindow(windowId) {
}
function refreshTab(tabId) {
- chromium.tabs.get(tabId, function(tab) {
+ chrome.tabs.get(tabId, function(tab) {
var input = new JsExprContext(tab);
var output = document.getElementById('tab_' + tab.id);
jstProcess(input, output);
@@ -225,7 +225,7 @@ function refreshTab(tabId) {
}
function refreshSelectedTab(windowId) {
- chromium.tabs.getSelected(windowId, function(tab) {
+ chrome.tabs.getSelected(windowId, function(tab) {
var input = new JsExprContext(tab);
var output = document.getElementById('tab_' + tab.id);
jstProcess(input, output);
@@ -275,11 +275,11 @@ function refreshSelectedTab(windowId) {
<div><input type="checkbox" jsvalues="checked:selected; id:'selected_' + id" /> Selected</div>
</div>
<button onclick="updateTab(this.jstdata)" jsvalues=".jstdata:id">Update Tab</button>
- <button onclick="chromium.tabs.remove(this.jstdata);" jsvalues=".jstdata:id">Close Tab</button>
+ <button onclick="chrome.tabs.remove(this.jstdata);" jsvalues=".jstdata:id">Close Tab</button>
</div>
</div>
</div>
- <button onclick="chromium.windows.removeWindow(this.jstdata);" jsvalues=".jstdata:id">Close Window</button>
+ <button onclick="chrome.windows.removeWindow(this.jstdata);" jsvalues=".jstdata:id">Close Window</button>
<button onclick="refreshSelectedTab(this.jstdata);" jsvalues=".jstdata:id">Refresh Selected Tab</button>
</div>
</div>
@@ -328,10 +328,9 @@ function refreshSelectedTab(windowId) {
<button onclick="updateAll();">Update All</button>
<button onclick="moveAll();">Move All</button>
<button onclick="clearLog();">-->Clear Log</button>
- <button onclick="chromium.windows.createWindow();">New Window</button>
+ <button onclick="chrome.windows.createWindow();">New Window</button>
</div>
<div id="log" style="background-color: #EEAAEE; margin: 20px; padding: 8px">
</div>
</body>
-</html>
-
+</html> \ No newline at end of file