OLD | NEW |
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 function create(title, type, parent, callback) { | 5 function create(title, type, parent, callback) { |
6 props = {}; | 6 props = {}; |
7 if (title) { | 7 if (title) { |
8 props.title = title; | 8 props.title = title; |
9 } | 9 } |
10 props.type = type; | 10 props.type = type; |
11 | 11 |
12 if (parent) { | 12 if (parent) { |
13 props.parentId = parent; | 13 props.parentId = parent; |
14 } | 14 } |
15 | 15 |
16 chrome.contextMenus.create(props, function() { | 16 chrome.contextMenus.create(props, function() { |
17 if (!chrome.extension.lastError && callback) { | 17 if (!chrome.runtime.lastError && callback) { |
18 callback(); | 18 callback(); |
19 } | 19 } |
20 }); | 20 }); |
21 } | 21 } |
22 | 22 |
23 function createTestSet(parent, callback) { | 23 function createTestSet(parent, callback) { |
24 create("radio1", "radio", parent); | 24 create("radio1", "radio", parent); |
25 create("radio2", "radio", parent); | 25 create("radio2", "radio", parent); |
26 create("normal1", "normal", parent); | 26 create("normal1", "normal", parent); |
27 create(null, "separator", parent); | 27 create(null, "separator", parent); |
28 create("normal2", "normal", parent); | 28 create("normal2", "normal", parent); |
29 create(null, "separator", parent); | 29 create(null, "separator", parent); |
30 create("radio3", "radio", parent); | 30 create("radio3", "radio", parent); |
31 create("radio4", "radio", parent); | 31 create("radio4", "radio", parent); |
32 create(null, "separator", parent); | 32 create(null, "separator", parent); |
33 create("normal3", "normal", parent, callback); | 33 create("normal3", "normal", parent, callback); |
34 } | 34 } |
OLD | NEW |