summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-16 22:20:00 +0000
committerrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-16 22:20:00 +0000
commit434c21e053a20e5d417125a62f6f9de31258a8ce (patch)
tree67e26ed41a65e474c7e5fa45bddf791e1897f492 /chrome/renderer
parent44b4b0ccfdfc1ca2a8a56094d86a554b79f43ce7 (diff)
downloadchromium_src-434c21e053a20e5d417125a62f6f9de31258a8ce.zip
chromium_src-434c21e053a20e5d417125a62f6f9de31258a8ce.tar.gz
chromium_src-434c21e053a20e5d417125a62f6f9de31258a8ce.tar.bz2
First step in abstracting extension api to common/shared "IDL" files (jsonschema).
In this step, All "normal" api calls and events (those that arrive or originate from the browser process) are routed through a single v8::Extension API Call ("StartRequest"). Additionally, internal string names for methods and events now match the js namespace (i.e. "RemoveTab" -> "tabs.remove"), in anticipation of having names be implicit from their api module & name in the api "IDL". TBR=aa,mpcomplete Review URL: http://codereview.chromium.org/149730 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20910 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/extensions/extension_api_client_unittest.cc68
-rw-r--r--chrome/renderer/extensions/extension_process_bindings.cc23
-rw-r--r--chrome/renderer/renderer_resources.grd2
-rw-r--r--chrome/renderer/resources/extension_process_bindings.js113
4 files changed, 93 insertions, 113 deletions
diff --git a/chrome/renderer/extensions/extension_api_client_unittest.cc b/chrome/renderer/extensions/extension_api_client_unittest.cc
index 05d631e..33fdbe1 100644
--- a/chrome/renderer/extensions/extension_api_client_unittest.cc
+++ b/chrome/renderer/extensions/extension_api_client_unittest.cc
@@ -120,7 +120,7 @@ TEST_F(ExtensionAPIClientTest, GetWindow) {
"Expected 'function' but got 'integer'.");
ExpectJsPass("chrome.windows.get(2, function(){})",
- "GetWindow", "2");
+ "windows.get", "2");
}
TEST_F(ExtensionAPIClientTest, GetCurentWindow) {
@@ -135,7 +135,7 @@ TEST_F(ExtensionAPIClientTest, GetCurentWindow) {
"Expected 'function' but got 'string'.");
ExpectJsPass("chrome.windows.getCurrent(function(){})",
- "GetCurrentWindow", "null");
+ "windows.getCurrent", "null");
}
TEST_F(ExtensionAPIClientTest, GetLastFocusedWindow) {
@@ -150,7 +150,7 @@ TEST_F(ExtensionAPIClientTest, GetLastFocusedWindow) {
"Expected 'function' but got 'string'.");
ExpectJsPass("chrome.windows.getLastFocused(function(){})",
- "GetLastFocusedWindow", "null");
+ "windows.getLastFocused", "null");
}
TEST_F(ExtensionAPIClientTest, GetAllWindows) {
@@ -162,13 +162,13 @@ TEST_F(ExtensionAPIClientTest, GetAllWindows) {
"Expected 'boolean' but got 'integer'.");
ExpectJsPass("chrome.windows.getAll(true, function(){})",
- "GetAllWindows", "true");
+ "windows.getAll", "true");
ExpectJsPass("chrome.windows.getAll(null, function(){})",
- "GetAllWindows", "null");
+ "windows.getAll", "null");
ExpectJsPass("chrome.windows.getAll(undefined, function(){})",
- "GetAllWindows", "null");
+ "windows.getAll", "null");
}
TEST_F(ExtensionAPIClientTest, CreateWindow) {
@@ -198,7 +198,7 @@ TEST_F(ExtensionAPIClientTest, CreateWindow) {
" width:100,"
" height:200"
"})",
- "CreateWindow",
+ "windows.create",
"{\"url\":\"http://www.google.com/\","
"\"left\":0,"
"\"top\":10,"
@@ -229,7 +229,7 @@ TEST_F(ExtensionAPIClientTest, UpdateWindow) {
" width:100,"
" height:200"
"})",
- "UpdateWindow",
+ "windows.update",
"[42,"
"{\"width\":100,"
"\"height\":200}]");
@@ -248,10 +248,10 @@ TEST_F(ExtensionAPIClientTest, RemoveWindow) {
"Expected 'function' but got 'integer'.");
ExpectJsPass("chrome.windows.remove(2, function(){})",
- "RemoveWindow", "2");
+ "windows.remove", "2");
ExpectJsPass("chrome.windows.remove(2)",
- "RemoveWindow", "2");
+ "windows.remove", "2");
}
// Tab API tests
@@ -272,7 +272,7 @@ TEST_F(ExtensionAPIClientTest, GetTab) {
"Expected 'function' but got 'integer'.");
ExpectJsPass("chrome.tabs.get(2, function(){})",
- "GetTab", "2");
+ "tabs.get", "2");
}
#if defined(OS_WIN)
@@ -289,7 +289,7 @@ TEST_F(ExtensionAPIClientTest, DetectTabLanguage) {
"Expected 'function' but got 'integer'.");
ExpectJsPass("chrome.tabs.detectLanguage(null, function(){})",
- "DetectTabLanguage", "null");
+ "tabs.detectLanguage", "null");
}
#endif
@@ -309,10 +309,10 @@ TEST_F(ExtensionAPIClientTest, GetSelectedTab) {
"Expected 'function' but got 'integer'.");
ExpectJsPass("chrome.tabs.getSelected(2, function(){})",
- "GetSelectedTab", "2");
+ "tabs.getSelected", "2");
ExpectJsPass("chrome.tabs.getSelected(null, function(){})",
- "GetSelectedTab", "null");
+ "tabs.getSelected", "null");
}
@@ -332,10 +332,10 @@ TEST_F(ExtensionAPIClientTest, GetAllTabsInWindow) {
"Expected 'integer' but got 'string'.");
ExpectJsPass("chrome.tabs.getAllInWindow(32, function(){})",
- "GetAllTabsInWindow", "32");
+ "tabs.getAllInWindow", "32");
ExpectJsPass("chrome.tabs.getAllInWindow(undefined, function(){})",
- "GetAllTabsInWindow", "null");
+ "tabs.getAllInWindow", "null");
}
TEST_F(ExtensionAPIClientTest, CreateTab) {
@@ -355,7 +355,7 @@ TEST_F(ExtensionAPIClientTest, CreateTab) {
" index: 2,"
" windowId:4"
"})",
- "CreateTab",
+ "tabs.create",
"{\"url\":\"http://www.google.com/\","
"\"selected\":true,"
"\"index\":2,"
@@ -376,7 +376,7 @@ TEST_F(ExtensionAPIClientTest, UpdateTab) {
" url:'http://www.google.com/',"
" selected:true"
"})",
- "UpdateTab",
+ "tabs.update",
"[42,"
"{\"url\":\"http://www.google.com/\","
"\"selected\":true}]");
@@ -396,7 +396,7 @@ TEST_F(ExtensionAPIClientTest, MoveTab) {
" index:3,"
" windowId:21"
"})",
- "MoveTab",
+ "tabs.move",
"[42,"
"{\"index\":3,"
"\"windowId\":21}]");
@@ -416,10 +416,10 @@ TEST_F(ExtensionAPIClientTest, RemoveTab) {
"Expected 'function' but got 'integer'.");
ExpectJsPass("chrome.tabs.remove(2, function(){})",
- "RemoveTab", "2");
+ "tabs.remove", "2");
ExpectJsPass("chrome.tabs.remove(2)",
- "RemoveTab", "2");
+ "tabs.remove", "2");
}
// Bookmark API tests
@@ -434,16 +434,16 @@ TEST_F(ExtensionAPIClientTest, CreateBookmark) {
ExpectJsPass(
"chrome.bookmarks.create({parentId:0, title:'x'}, function(){})",
- "CreateBookmark",
+ "bookmarks.create",
"{\"parentId\":0,\"title\":\"x\"}");
}
TEST_F(ExtensionAPIClientTest, GetBookmarks) {
ExpectJsPass("chrome.bookmarks.get(0, function(){});",
- "GetBookmarks",
+ "bookmarks.get",
"0");
ExpectJsPass("chrome.bookmarks.get([0,1,2,3], function(){});",
- "GetBookmarks",
+ "bookmarks.get",
"[0,1,2,3]");
ExpectJsFail("chrome.bookmarks.get(null, function(){});",
"Uncaught Error: Parameter 0 is required.");
@@ -458,43 +458,43 @@ TEST_F(ExtensionAPIClientTest, GetBookmarks) {
TEST_F(ExtensionAPIClientTest, GetBookmarkChildren) {
ExpectJsPass("chrome.bookmarks.getChildren(42, function(){});",
- "GetBookmarkChildren",
+ "bookmarks.getChildren",
"42");
}
TEST_F(ExtensionAPIClientTest, GetBookmarkTree) {
ExpectJsPass("chrome.bookmarks.getTree(function(){});",
- "GetBookmarkTree",
+ "bookmarks.getTree",
"null");
}
TEST_F(ExtensionAPIClientTest, SearchBookmarks) {
ExpectJsPass("chrome.bookmarks.search('hello',function(){});",
- "SearchBookmarks",
+ "bookmarks.search",
"\"hello\"");
}
TEST_F(ExtensionAPIClientTest, RemoveBookmark) {
ExpectJsPass("chrome.bookmarks.remove(42);",
- "RemoveBookmark",
+ "bookmarks.remove",
"[42,false]");
}
TEST_F(ExtensionAPIClientTest, RemoveBookmarkTree) {
ExpectJsPass("chrome.bookmarks.removeTree(42);",
- "RemoveBookmark",
+ "bookmarks.removeTree",
"[42,true]");
}
TEST_F(ExtensionAPIClientTest, MoveBookmark) {
ExpectJsPass("chrome.bookmarks.move(42,{parentId:1,index:0});",
- "MoveBookmark",
+ "bookmarks.move",
"[42,{\"parentId\":1,\"index\":0}]");
}
TEST_F(ExtensionAPIClientTest, SetBookmarkTitle) {
ExpectJsPass("chrome.bookmarks.update(42,{title:'x'});",
- "SetBookmarkTitle",
+ "bookmarks.update",
"[42,{\"title\":\"x\"}]");
}
@@ -502,19 +502,19 @@ TEST_F(ExtensionAPIClientTest, EnablePageAction) {
// Basic old-school enablePageAction call.
ExpectJsPass("chrome.pageActions.enableForTab("
"\"dummy\", {tabId: 0, url: \"http://foo/\"});",
- "EnablePageAction",
+ "pageActions.enableForTab",
"[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\"}]");
// Try both optional parameters (title and iconId).
ExpectJsPass("chrome.pageActions.enableForTab("
"\"dummy\", {tabId: 0, url: \"http://foo/\","
"title: \"a\", iconId: 0});",
- "EnablePageAction",
+ "pageActions.enableForTab",
"[\"dummy\",{\"tabId\":0,\"url\":\"http://foo/\","
"\"title\":\"a\",\"iconId\":0}]");
// Now try disablePageAction.
ExpectJsPass("chrome.pageActions.disableForTab("
"\"dummy\", {tabId: 0, url: \"http://foo/\"});",
- "DisablePageAction",
+ "pageActions.disableForTab",
"[\"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 fd70dcf..35fa0a4 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -64,16 +64,14 @@ class ExtensionImpl : public ExtensionBase {
virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
v8::Handle<v8::String> name) {
- std::set<std::string>* names = GetFunctionNameSet();
-
if (name->Equals(v8::String::New("GetViews"))) {
return v8::FunctionTemplate::New(GetViews);
} else if (name->Equals(v8::String::New("GetNextRequestId"))) {
return v8::FunctionTemplate::New(GetNextRequestId);
} else if (name->Equals(v8::String::New("GetCurrentPageActions"))) {
return v8::FunctionTemplate::New(GetCurrentPageActions);
- } else if (names->find(*v8::String::AsciiValue(name)) != names->end()) {
- return v8::FunctionTemplate::New(StartRequest, name);
+ } else if (name->Equals(v8::String::New("StartRequest"))) {
+ return v8::FunctionTemplate::New(StartRequest);
}
return ExtensionBase::GetNativeFunction(name);
@@ -146,14 +144,19 @@ class ExtensionImpl : public ExtensionBase {
if (!renderview)
return v8::Undefined();
- if (args.Length() != 3 || !args[0]->IsString() || !args[1]->IsInt32() ||
- !args[2]->IsBoolean())
+ if (args.Length() != 4 || !args[0]->IsString() || !args[1]->IsString() ||
+ !args[2]->IsInt32() || !args[3]->IsBoolean())
+ return v8::Undefined();
+
+ std::string name = *v8::String::AsciiValue(args[0]);
+ if (GetFunctionNameSet()->find(name) == GetFunctionNameSet()->end()) {
+ NOTREACHED() << "Unexpected function " << name;
return v8::Undefined();
+ }
- std::string name = *v8::String::AsciiValue(args.Data());
- std::string json_args = *v8::String::Utf8Value(args[0]);
- int request_id = args[1]->Int32Value();
- bool has_callback = args[2]->BooleanValue();
+ std::string json_args = *v8::String::Utf8Value(args[1]);
+ int request_id = args[2]->Int32Value();
+ bool has_callback = args[3]->BooleanValue();
v8::Persistent<v8::Context> current_context =
v8::Persistent<v8::Context>::New(v8::Context::GetCurrent());
diff --git a/chrome/renderer/renderer_resources.grd b/chrome/renderer/renderer_resources.grd
index 3067b3e..4af745f 100644
--- 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. sidchat1 -->
+without changes to the corresponding grd file. weeeeee! -->
<grit latest_public_release="0" current_release="1">
<outputs>
<output filename="grit/renderer_resources.h" type="rc_header">
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js
index 9423afe..3f05543 100644
--- a/chrome/renderer/resources/extension_process_bindings.js
+++ b/chrome/renderer/resources/extension_process_bindings.js
@@ -12,33 +12,10 @@
var chrome = chrome || {};
(function() {
+ native function StartRequest();
+ native function GetCurrentPageActions();
native function GetViews();
- native function GetWindow();
- native function GetCurrentWindow();
- native function GetLastFocusedWindow();
- native function CreateWindow();
- native function UpdateWindow();
- native function RemoveWindow();
- native function GetAllWindows();
- native function GetTab();
- native function GetSelectedTab();
- native function GetAllTabsInWindow();
- native function CreateTab();
- native function UpdateTab();
- native function MoveTab();
- native function RemoveTab();
- native function DetectTabLanguage();
- native function EnablePageAction();
- native function DisablePageAction();
native function GetCurrentPageActions();
- native function GetBookmarks();
- native function GetBookmarkChildren();
- native function GetBookmarkTree();
- native function SearchBookmarks();
- native function RemoveBookmark();
- native function CreateBookmark();
- native function MoveBookmark();
- native function SetBookmarkTitle();
native function GetChromeHidden();
native function GetNextRequestId();
@@ -103,7 +80,7 @@ var chrome = chrome || {};
};
// Send an API request and optionally register a callback.
- function sendRequest(request, args, callback) {
+ function sendRequest(functionName, args, callback) {
// JSON.stringify doesn't support a root object which is undefined.
if (args === undefined)
args = null;
@@ -114,7 +91,7 @@ var chrome = chrome || {};
hasCallback = true;
callbacks[requestId] = callback;
}
- request(sargs, requestId, hasCallback);
+ StartRequest(functionName, sargs, requestId, hasCallback);
}
//----------------------------------------------------------------------------
@@ -124,7 +101,7 @@ var chrome = chrome || {};
chrome.windows.get = function(windowId, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(GetWindow, windowId, callback);
+ sendRequest("windows.get", windowId, callback);
};
chrome.windows.get.params = [
@@ -134,7 +111,7 @@ var chrome = chrome || {};
chrome.windows.getCurrent = function(callback) {
validate(arguments, arguments.callee.params);
- sendRequest(GetCurrentWindow, null, callback);
+ sendRequest("windows.getCurrent", null, callback);
};
chrome.windows.getCurrent.params = [
@@ -143,7 +120,7 @@ var chrome = chrome || {};
chrome.windows.getLastFocused = function(callback) {
validate(arguments, arguments.callee.params);
- sendRequest(GetLastFocusedWindow, null, callback);
+ sendRequest("windows.getLastFocused", null, callback);
};
chrome.windows.getLastFocused.params = [
@@ -152,7 +129,7 @@ var chrome = chrome || {};
chrome.windows.getAll = function(populate, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(GetAllWindows, populate, callback);
+ sendRequest("windows.getAll", populate, callback);
};
chrome.windows.getAll.params = [
@@ -162,7 +139,7 @@ var chrome = chrome || {};
chrome.windows.create = function(createData, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(CreateWindow, createData, callback);
+ sendRequest("windows.create", createData, callback);
};
chrome.windows.create.params = [
{
@@ -181,7 +158,7 @@ var chrome = chrome || {};
chrome.windows.update = function(windowId, updateData, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(UpdateWindow, [windowId, updateData], callback);
+ sendRequest("windows.update", [windowId, updateData], callback);
};
chrome.windows.update.params = [
chrome.types.pInt,
@@ -199,7 +176,7 @@ var chrome = chrome || {};
chrome.windows.remove = function(windowId, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(RemoveWindow, windowId, callback);
+ sendRequest("windows.remove", windowId, callback);
};
chrome.windows.remove.params = [
@@ -209,17 +186,17 @@ var chrome = chrome || {};
// sends (windowId).
// *WILL* be followed by tab-attached AND then tab-selection-changed.
- chrome.windows.onCreated = new chrome.Event("window-created");
+ chrome.windows.onCreated = new chrome.Event("windows.onCreated");
// 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
- chrome.windows.onRemoved = new chrome.Event("window-removed");
+ chrome.windows.onRemoved = new chrome.Event("windows.onRemoved");
// sends (windowId).
chrome.windows.onFocusChanged =
- new chrome.Event("window-focus-changed");
+ new chrome.Event("windows.onFocusChanged");
//----------------------------------------------------------------------------
@@ -228,7 +205,7 @@ var chrome = chrome || {};
chrome.tabs.get = function(tabId, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(GetTab, tabId, callback);
+ sendRequest("tabs.get", tabId, callback);
};
chrome.tabs.get.params = [
@@ -238,7 +215,7 @@ var chrome = chrome || {};
chrome.tabs.getSelected = function(windowId, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(GetSelectedTab, windowId, callback);
+ sendRequest("tabs.getSelected", windowId, callback);
};
chrome.tabs.getSelected.params = [
@@ -248,7 +225,7 @@ var chrome = chrome || {};
chrome.tabs.getAllInWindow = function(windowId, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(GetAllTabsInWindow, windowId, callback);
+ sendRequest("tabs.getAllInWindow", windowId, callback);
};
chrome.tabs.getAllInWindow.params = [
@@ -258,7 +235,7 @@ var chrome = chrome || {};
chrome.tabs.create = function(tab, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(CreateTab, tab, callback);
+ sendRequest("tabs.create", tab, callback);
};
chrome.tabs.create.params = [
@@ -276,7 +253,7 @@ var chrome = chrome || {};
chrome.tabs.update = function(tabId, updates, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(UpdateTab, [tabId, updates], callback);
+ sendRequest("tabs.update", [tabId, updates], callback);
};
chrome.tabs.update.params = [
@@ -293,7 +270,7 @@ var chrome = chrome || {};
chrome.tabs.move = function(tabId, moveProps, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(MoveTab, [tabId, moveProps], callback);
+ sendRequest("tabs.move", [tabId, moveProps], callback);
};
chrome.tabs.move.params = [
@@ -310,7 +287,7 @@ var chrome = chrome || {};
chrome.tabs.remove = function(tabId, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(RemoveTab, tabId, callback);
+ sendRequest("tabs.remove", tabId, callback);
};
chrome.tabs.remove.params = [
@@ -320,7 +297,7 @@ var chrome = chrome || {};
chrome.tabs.detectLanguage = function(tabId, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(DetectTabLanguage, tabId, callback);
+ sendRequest("tabs.detectLanguage", tabId, callback);
};
chrome.tabs.detectLanguage.params = [
@@ -331,31 +308,31 @@ var chrome = chrome || {};
// Sends ({Tab}).
// Will *NOT* be followed by tab-attached - it is implied.
// *MAY* be followed by tab-selection-changed.
- chrome.tabs.onCreated = new chrome.Event("tab-created");
+ chrome.tabs.onCreated = new chrome.Event("tabs.onCreated");
// Sends (tabId, {ChangedProps}).
- chrome.tabs.onUpdated = new chrome.Event("tab-updated");
+ chrome.tabs.onUpdated = new chrome.Event("tabs.onUpdated");
// Sends (tabId, {windowId, fromIndex, toIndex}).
// Tabs can only "move" within a window.
- chrome.tabs.onMoved = new chrome.Event("tab-moved");
+ chrome.tabs.onMoved = new chrome.Event("tabs.onMoved");
// Sends (tabId, {windowId}).
chrome.tabs.onSelectionChanged =
- new chrome.Event("tab-selection-changed");
+ new chrome.Event("tabs.onSelectionChanged");
// Sends (tabId, {newWindowId, newPosition}).
// *MAY* be followed by tab-selection-changed.
- chrome.tabs.onAttached = new chrome.Event("tab-attached");
+ chrome.tabs.onAttached = new chrome.Event("tabs.onAttached");
// Sends (tabId, {oldWindowId, oldPosition}).
// *WILL* be followed by tab-selection-changed.
- chrome.tabs.onDetached = new chrome.Event("tab-detached");
+ chrome.tabs.onDetached = new chrome.Event("tabs.onDetached");
// Sends (tabId).
// *WILL* be followed by tab-selection-changed.
// Will *NOT* be followed or preceded by tab-detached.
- chrome.tabs.onRemoved = new chrome.Event("tab-removed");
+ chrome.tabs.onRemoved = new chrome.Event("tabs.onRemoved");
//----------------------------------------------------------------------------
@@ -364,7 +341,7 @@ var chrome = chrome || {};
chrome.pageActions.enableForTab = function(pageActionId, action) {
validate(arguments, arguments.callee.params);
- sendRequest(EnablePageAction, [pageActionId, action]);
+ sendRequest("pageActions.enableForTab", [pageActionId, action]);
}
chrome.pageActions.enableForTab.params = [
@@ -383,7 +360,7 @@ var chrome = chrome || {};
chrome.pageActions.disableForTab = function(pageActionId, action) {
validate(arguments, arguments.callee.params);
- sendRequest(DisablePageAction, [pageActionId, action]);
+ sendRequest("pageActions.disableForTab", [pageActionId, action]);
}
chrome.pageActions.disableForTab.params = [
@@ -415,7 +392,7 @@ var chrome = chrome || {};
chrome.bookmarks.get = function(ids, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(GetBookmarks, ids, callback);
+ sendRequest("bookmarks.get", ids, callback);
};
chrome.bookmarks.get.params = [
@@ -425,7 +402,7 @@ var chrome = chrome || {};
chrome.bookmarks.getChildren = function(id, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(GetBookmarkChildren, id, callback);
+ sendRequest("bookmarks.getChildren", id, callback);
};
chrome.bookmarks.getChildren.params = [
@@ -435,7 +412,7 @@ var chrome = chrome || {};
chrome.bookmarks.getTree = function(callback) {
validate(arguments, arguments.callee.params);
- sendRequest(GetBookmarkTree, null, callback);
+ sendRequest("bookmarks.getTree", null, callback);
};
// TODO(erikkay): allow it to take an optional id as a starting point
@@ -446,7 +423,7 @@ var chrome = chrome || {};
chrome.bookmarks.search = function(query, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(SearchBookmarks, query, callback);
+ sendRequest("bookmarks.search", query, callback);
};
chrome.bookmarks.search.params = [
@@ -456,7 +433,7 @@ var chrome = chrome || {};
chrome.bookmarks.remove = function(id, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(RemoveBookmark, [id, false], callback);
+ sendRequest("bookmarks.remove", [id, false], callback);
};
chrome.bookmarks.remove.params = [
@@ -466,7 +443,7 @@ var chrome = chrome || {};
chrome.bookmarks.removeTree = function(id, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(RemoveBookmark, [id, true], callback);
+ sendRequest("bookmarks.removeTree", [id, true], callback);
};
chrome.bookmarks.removeTree.params = [
@@ -476,7 +453,7 @@ var chrome = chrome || {};
chrome.bookmarks.create = function(bookmark, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(CreateBookmark, bookmark, callback);
+ sendRequest("bookmarks.create", bookmark, callback);
};
chrome.bookmarks.create.params = [
@@ -494,7 +471,7 @@ var chrome = chrome || {};
chrome.bookmarks.move = function(id, destination, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(MoveBookmark, [id, destination], callback);
+ sendRequest("bookmarks.move", [id, destination], callback);
};
chrome.bookmarks.move.params = [
@@ -511,7 +488,7 @@ var chrome = chrome || {};
chrome.bookmarks.update = function(id, changes, callback) {
validate(arguments, arguments.callee.params);
- sendRequest(SetBookmarkTitle, [id, changes], callback);
+ sendRequest("bookmarks.update", [id, changes], callback);
};
chrome.bookmarks.update.params = [
@@ -529,21 +506,21 @@ var chrome = chrome || {};
// Sends (id, {title, url, parentId, index, dateAdded, dateGroupModified})
// date values are milliseconds since the UTC epoch.
- chrome.bookmarks.onAdded = new chrome.Event("bookmark-added");
+ chrome.bookmarks.onAdded = new chrome.Event("bookmarks.onAdded");
// Sends (id, {parentId, index})
- chrome.bookmarks.onRemoved = new chrome.Event("bookmark-removed");
+ chrome.bookmarks.onRemoved = new chrome.Event("bookmarks.onRemoved");
// Sends (id, object) where object has list of properties that have changed.
// Currently, this only ever includes 'title'.
- chrome.bookmarks.onChanged = new chrome.Event("bookmark-changed");
+ chrome.bookmarks.onChanged = new chrome.Event("bookmarks.onChanged");
// Sends (id, {parentId, index, oldParentId, oldIndex})
- chrome.bookmarks.onMoved = new chrome.Event("bookmark-moved");
+ chrome.bookmarks.onMoved = new chrome.Event("bookmarks.onMoved");
// Sends (id, [childrenIds])
chrome.bookmarks.onChildrenReordered =
- new chrome.Event("bookmark-children-reordered");
+ new chrome.Event("bookmarks.onChildrenReordered");
//----------------------------------------------------------------------------