| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // Generated from namespace: contextMenus |
| 6 |
| 7 part of chrome; |
| 8 |
| 9 /** |
| 10 * Types |
| 11 */ |
| 12 |
| 13 /// Information sent when a context menu item is clicked. |
| 14 class ContextmenusOnClickData extends ChromeObject { |
| 15 /* |
| 16 * Public constructor |
| 17 */ |
| 18 ContextmenusOnClickData({Object menuItemId, Object parentMenuItemId, String me
diaType, String linkUrl, String srcUrl, String pageUrl, String frameUrl, String
selectionText, bool editable, bool wasChecked, bool checked}) { |
| 19 if (?menuItemId) |
| 20 this.menuItemId = menuItemId; |
| 21 if (?parentMenuItemId) |
| 22 this.parentMenuItemId = parentMenuItemId; |
| 23 if (?mediaType) |
| 24 this.mediaType = mediaType; |
| 25 if (?linkUrl) |
| 26 this.linkUrl = linkUrl; |
| 27 if (?srcUrl) |
| 28 this.srcUrl = srcUrl; |
| 29 if (?pageUrl) |
| 30 this.pageUrl = pageUrl; |
| 31 if (?frameUrl) |
| 32 this.frameUrl = frameUrl; |
| 33 if (?selectionText) |
| 34 this.selectionText = selectionText; |
| 35 if (?editable) |
| 36 this.editable = editable; |
| 37 if (?wasChecked) |
| 38 this.wasChecked = wasChecked; |
| 39 if (?checked) |
| 40 this.checked = checked; |
| 41 } |
| 42 |
| 43 /* |
| 44 * Private constructor |
| 45 */ |
| 46 ContextmenusOnClickData._proxy(_jsObject) : super._proxy(_jsObject); |
| 47 |
| 48 /* |
| 49 * Public accessors |
| 50 */ |
| 51 /// The ID of the menu item that was clicked. |
| 52 Object get menuItemId => JS('Object', '#.menuItemId', this._jsObject); |
| 53 |
| 54 void set menuItemId(Object menuItemId) { |
| 55 JS('void', '#.menuItemId = #', this._jsObject, menuItemId); |
| 56 } |
| 57 |
| 58 /// The parent ID, if any, for the item clicked. |
| 59 Object get parentMenuItemId => JS('Object', '#.parentMenuItemId', this._jsObje
ct); |
| 60 |
| 61 void set parentMenuItemId(Object parentMenuItemId) { |
| 62 JS('void', '#.parentMenuItemId = #', this._jsObject, parentMenuItemId); |
| 63 } |
| 64 |
| 65 /// One of 'image', 'video', or 'audio' if the context menu was activated on |
| 66 /// one of these types of elements. |
| 67 String get mediaType => JS('String', '#.mediaType', this._jsObject); |
| 68 |
| 69 void set mediaType(String mediaType) { |
| 70 JS('void', '#.mediaType = #', this._jsObject, mediaType); |
| 71 } |
| 72 |
| 73 /// If the element is a link, the URL it points to. |
| 74 String get linkUrl => JS('String', '#.linkUrl', this._jsObject); |
| 75 |
| 76 void set linkUrl(String linkUrl) { |
| 77 JS('void', '#.linkUrl = #', this._jsObject, linkUrl); |
| 78 } |
| 79 |
| 80 /// Will be present for elements with a 'src' URL. |
| 81 String get srcUrl => JS('String', '#.srcUrl', this._jsObject); |
| 82 |
| 83 void set srcUrl(String srcUrl) { |
| 84 JS('void', '#.srcUrl = #', this._jsObject, srcUrl); |
| 85 } |
| 86 |
| 87 /// The URL of the page where the menu item was clicked. This property is not |
| 88 /// set if the click occured in a context where there is no current page, such |
| 89 /// as in a launcher context menu. |
| 90 String get pageUrl => JS('String', '#.pageUrl', this._jsObject); |
| 91 |
| 92 void set pageUrl(String pageUrl) { |
| 93 JS('void', '#.pageUrl = #', this._jsObject, pageUrl); |
| 94 } |
| 95 |
| 96 /// The URL of the frame of the element where the context menu was clicked, i
f |
| 97 /// it was in a frame. |
| 98 String get frameUrl => JS('String', '#.frameUrl', this._jsObject); |
| 99 |
| 100 void set frameUrl(String frameUrl) { |
| 101 JS('void', '#.frameUrl = #', this._jsObject, frameUrl); |
| 102 } |
| 103 |
| 104 /// The text for the context selection, if any. |
| 105 String get selectionText => JS('String', '#.selectionText', this._jsObject); |
| 106 |
| 107 void set selectionText(String selectionText) { |
| 108 JS('void', '#.selectionText = #', this._jsObject, selectionText); |
| 109 } |
| 110 |
| 111 /// A flag indicating whether the element is editable (text input, textarea, |
| 112 /// etc.). |
| 113 bool get editable => JS('bool', '#.editable', this._jsObject); |
| 114 |
| 115 void set editable(bool editable) { |
| 116 JS('void', '#.editable = #', this._jsObject, editable); |
| 117 } |
| 118 |
| 119 /// A flag indicating the state of a checkbox or radio item before it was |
| 120 /// clicked. |
| 121 bool get wasChecked => JS('bool', '#.wasChecked', this._jsObject); |
| 122 |
| 123 void set wasChecked(bool wasChecked) { |
| 124 JS('void', '#.wasChecked = #', this._jsObject, wasChecked); |
| 125 } |
| 126 |
| 127 /// A flag indicating the state of a checkbox or radio item after it is |
| 128 /// clicked. |
| 129 bool get checked => JS('bool', '#.checked', this._jsObject); |
| 130 |
| 131 void set checked(bool checked) { |
| 132 JS('void', '#.checked = #', this._jsObject, checked); |
| 133 } |
| 134 |
| 135 } |
| 136 |
| 137 /** |
| 138 * Events |
| 139 */ |
| 140 |
| 141 /// Fired when a context menu item is clicked. |
| 142 class Event_context_menus_onClicked extends Event { |
| 143 void addListener(void callback(ContextmenusOnClickData info, Tab tab)) { |
| 144 void __proxy_callback(info, tab) { |
| 145 if (?callback) { |
| 146 callback(new ContextmenusOnClickData._proxy(info), new Tab._proxy(tab)); |
| 147 } |
| 148 } |
| 149 super.addListener(callback); |
| 150 } |
| 151 |
| 152 void removeListener(void callback(ContextmenusOnClickData info, Tab tab)) { |
| 153 void __proxy_callback(info, tab) { |
| 154 if (?callback) { |
| 155 callback(new ContextmenusOnClickData._proxy(info), new Tab._proxy(tab)); |
| 156 } |
| 157 } |
| 158 super.removeListener(callback); |
| 159 } |
| 160 |
| 161 bool hasListener(void callback(ContextmenusOnClickData info, Tab tab)) { |
| 162 void __proxy_callback(info, tab) { |
| 163 if (?callback) { |
| 164 callback(new ContextmenusOnClickData._proxy(info), new Tab._proxy(tab)); |
| 165 } |
| 166 } |
| 167 super.hasListener(callback); |
| 168 } |
| 169 |
| 170 Event_context_menus_onClicked(jsObject) : super._(jsObject, 2); |
| 171 } |
| 172 |
| 173 /** |
| 174 * Functions |
| 175 */ |
| 176 |
| 177 class API_context_menus { |
| 178 /* |
| 179 * API connection |
| 180 */ |
| 181 Object _jsObject; |
| 182 |
| 183 /* |
| 184 * Events |
| 185 */ |
| 186 Event_context_menus_onClicked onClicked; |
| 187 |
| 188 /* |
| 189 * Functions |
| 190 */ |
| 191 /// Creates a new context menu item. Note that if an error occurs during |
| 192 /// creation, you may not find out until the creation callback fires (the |
| 193 /// details will be in chrome.runtime.lastError). |
| 194 Object create(Object createProperties, [void callback()]) => JS('Object', '#.c
reate(#, #)', this._jsObject, convertArgument(createProperties), convertDartClos
ureToJS(callback, 0)); |
| 195 |
| 196 /// Updates a previously created context menu item. |
| 197 void update(Object id, Object updateProperties, [void callback()]) => JS('void
', '#.update(#, #, #)', this._jsObject, id, convertArgument(updateProperties), c
onvertDartClosureToJS(callback, 0)); |
| 198 |
| 199 /// Removes a context menu item. |
| 200 void remove(Object menuItemId, [void callback()]) => JS('void', '#.remove(#, #
)', this._jsObject, menuItemId, convertDartClosureToJS(callback, 0)); |
| 201 |
| 202 /// Removes all context menu items added by this extension. |
| 203 void removeAll([void callback()]) => JS('void', '#.removeAll(#)', this._jsObje
ct, convertDartClosureToJS(callback, 0)); |
| 204 |
| 205 API_context_menus(this._jsObject) { |
| 206 onClicked = new Event_context_menus_onClicked(JS('', '#.onClicked', this._js
Object)); |
| 207 } |
| 208 } |
| OLD | NEW |