| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // The onClicked callback function. | 5 // The onClicked callback function. |
| 6 function onClickHandler(info, tab) { | 6 function onClickHandler(info, tab) { |
| 7 if (info.menuItemId == "radio1" || info.menuItemId == "radio2") { | 7 if (info.menuItemId == "radio1" || info.menuItemId == "radio2") { |
| 8 console.log("radio item " + info.menuItemId + | 8 console.log("radio item " + info.menuItemId + |
| 9 " was clicked (previous checked state was " + | 9 " was clicked (previous checked state was " + |
| 10 info.wasChecked + ")"); | 10 info.wasChecked + ")"); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 {"title": "Checkbox1", "type": "checkbox", "id": "checkbox1"}); | 56 {"title": "Checkbox1", "type": "checkbox", "id": "checkbox1"}); |
| 57 chrome.contextMenus.create( | 57 chrome.contextMenus.create( |
| 58 {"title": "Checkbox2", "type": "checkbox", "id": "checkbox2"}); | 58 {"title": "Checkbox2", "type": "checkbox", "id": "checkbox2"}); |
| 59 console.log("checkbox1 checkbox2"); | 59 console.log("checkbox1 checkbox2"); |
| 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 "duplicate item child1 should show up"); | 64 "duplicate item child1 should show up"); |
| 65 chrome.contextMenus.create({"title": "Oops", "id": "child1"}, function() { | 65 chrome.contextMenus.create({"title": "Oops", "id": "child1"}, 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 }); |
| 70 }); | 70 }); |
| OLD | NEW |