Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: chrome/common/extensions/docs/examples/api/contextMenus/basic/sample.js

Issue 11745015: Update references to the extension messaging APIs to point to the "runtime" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A generic onclick callback function. 5 // A generic onclick callback function.
6 function genericOnClick(info, tab) { 6 function genericOnClick(info, tab) {
7 console.log("item " + info.menuItemId + " was clicked"); 7 console.log("item " + info.menuItemId + " was clicked");
8 console.log("info: " + JSON.stringify(info)); 8 console.log("info: " + JSON.stringify(info));
9 console.log("tab: " + JSON.stringify(tab)); 9 console.log("tab: " + JSON.stringify(tab));
10 } 10 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 var checkbox2 = chrome.contextMenus.create( 56 var checkbox2 = chrome.contextMenus.create(
57 {"title": "Checkbox2", "type": "checkbox", "onclick":checkboxOnClick}); 57 {"title": "Checkbox2", "type": "checkbox", "onclick":checkboxOnClick});
58 console.log("checkbox1:" + checkbox1 + " checkbox2:" + checkbox2); 58 console.log("checkbox1:" + checkbox1 + " checkbox2:" + checkbox2);
59 59
60 60
61 // Intentionally create an invalid item, to show off error checking in the 61 // Intentionally create an invalid item, to show off error checking in the
62 // create callback. 62 // create callback.
63 console.log("About to try creating an invalid item - an error about " + 63 console.log("About to try creating an invalid item - an error about " +
64 "item 999 should show up"); 64 "item 999 should show up");
65 chrome.contextMenus.create({"title": "Oops", "parentId":999}, function() { 65 chrome.contextMenus.create({"title": "Oops", "parentId":999}, function() {
66 if (chrome.extension.lastError) { 66 if (chrome.runtime.lastError) {
67 console.log("Got expected error: " + chrome.extension.lastError.message); 67 console.log("Got expected error: " + chrome.runtime.lastError.message);
68 } 68 }
69 }); 69 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698