| Index: tools/dom/src/chrome/context_menus.dart
|
| diff --git a/tools/dom/src/chrome/context_menus.dart b/tools/dom/src/chrome/context_menus.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..945d655247a16cd6de09c50c8455b0d352a92d37
|
| --- /dev/null
|
| +++ b/tools/dom/src/chrome/context_menus.dart
|
| @@ -0,0 +1,208 @@
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +// Generated from namespace: contextMenus
|
| +
|
| +part of chrome;
|
| +
|
| +/**
|
| + * Types
|
| + */
|
| +
|
| +/// Information sent when a context menu item is clicked.
|
| +class ContextmenusOnClickData extends ChromeObject {
|
| + /*
|
| + * Public constructor
|
| + */
|
| + ContextmenusOnClickData({Object menuItemId, Object parentMenuItemId, String mediaType, String linkUrl, String srcUrl, String pageUrl, String frameUrl, String selectionText, bool editable, bool wasChecked, bool checked}) {
|
| + if (?menuItemId)
|
| + this.menuItemId = menuItemId;
|
| + if (?parentMenuItemId)
|
| + this.parentMenuItemId = parentMenuItemId;
|
| + if (?mediaType)
|
| + this.mediaType = mediaType;
|
| + if (?linkUrl)
|
| + this.linkUrl = linkUrl;
|
| + if (?srcUrl)
|
| + this.srcUrl = srcUrl;
|
| + if (?pageUrl)
|
| + this.pageUrl = pageUrl;
|
| + if (?frameUrl)
|
| + this.frameUrl = frameUrl;
|
| + if (?selectionText)
|
| + this.selectionText = selectionText;
|
| + if (?editable)
|
| + this.editable = editable;
|
| + if (?wasChecked)
|
| + this.wasChecked = wasChecked;
|
| + if (?checked)
|
| + this.checked = checked;
|
| + }
|
| +
|
| + /*
|
| + * Private constructor
|
| + */
|
| + ContextmenusOnClickData._proxy(_jsObject) : super._proxy(_jsObject);
|
| +
|
| + /*
|
| + * Public accessors
|
| + */
|
| + /// The ID of the menu item that was clicked.
|
| + Object get menuItemId => JS('Object', '#.menuItemId', this._jsObject);
|
| +
|
| + void set menuItemId(Object menuItemId) {
|
| + JS('void', '#.menuItemId = #', this._jsObject, menuItemId);
|
| + }
|
| +
|
| + /// The parent ID, if any, for the item clicked.
|
| + Object get parentMenuItemId => JS('Object', '#.parentMenuItemId', this._jsObject);
|
| +
|
| + void set parentMenuItemId(Object parentMenuItemId) {
|
| + JS('void', '#.parentMenuItemId = #', this._jsObject, parentMenuItemId);
|
| + }
|
| +
|
| + /// One of 'image', 'video', or 'audio' if the context menu was activated on
|
| + /// one of these types of elements.
|
| + String get mediaType => JS('String', '#.mediaType', this._jsObject);
|
| +
|
| + void set mediaType(String mediaType) {
|
| + JS('void', '#.mediaType = #', this._jsObject, mediaType);
|
| + }
|
| +
|
| + /// If the element is a link, the URL it points to.
|
| + String get linkUrl => JS('String', '#.linkUrl', this._jsObject);
|
| +
|
| + void set linkUrl(String linkUrl) {
|
| + JS('void', '#.linkUrl = #', this._jsObject, linkUrl);
|
| + }
|
| +
|
| + /// Will be present for elements with a 'src' URL.
|
| + String get srcUrl => JS('String', '#.srcUrl', this._jsObject);
|
| +
|
| + void set srcUrl(String srcUrl) {
|
| + JS('void', '#.srcUrl = #', this._jsObject, srcUrl);
|
| + }
|
| +
|
| + /// The URL of the page where the menu item was clicked. This property is not
|
| + /// set if the click occured in a context where there is no current page, such
|
| + /// as in a launcher context menu.
|
| + String get pageUrl => JS('String', '#.pageUrl', this._jsObject);
|
| +
|
| + void set pageUrl(String pageUrl) {
|
| + JS('void', '#.pageUrl = #', this._jsObject, pageUrl);
|
| + }
|
| +
|
| + /// The URL of the frame of the element where the context menu was clicked, if
|
| + /// it was in a frame.
|
| + String get frameUrl => JS('String', '#.frameUrl', this._jsObject);
|
| +
|
| + void set frameUrl(String frameUrl) {
|
| + JS('void', '#.frameUrl = #', this._jsObject, frameUrl);
|
| + }
|
| +
|
| + /// The text for the context selection, if any.
|
| + String get selectionText => JS('String', '#.selectionText', this._jsObject);
|
| +
|
| + void set selectionText(String selectionText) {
|
| + JS('void', '#.selectionText = #', this._jsObject, selectionText);
|
| + }
|
| +
|
| + /// A flag indicating whether the element is editable (text input, textarea,
|
| + /// etc.).
|
| + bool get editable => JS('bool', '#.editable', this._jsObject);
|
| +
|
| + void set editable(bool editable) {
|
| + JS('void', '#.editable = #', this._jsObject, editable);
|
| + }
|
| +
|
| + /// A flag indicating the state of a checkbox or radio item before it was
|
| + /// clicked.
|
| + bool get wasChecked => JS('bool', '#.wasChecked', this._jsObject);
|
| +
|
| + void set wasChecked(bool wasChecked) {
|
| + JS('void', '#.wasChecked = #', this._jsObject, wasChecked);
|
| + }
|
| +
|
| + /// A flag indicating the state of a checkbox or radio item after it is
|
| + /// clicked.
|
| + bool get checked => JS('bool', '#.checked', this._jsObject);
|
| +
|
| + void set checked(bool checked) {
|
| + JS('void', '#.checked = #', this._jsObject, checked);
|
| + }
|
| +
|
| +}
|
| +
|
| +/**
|
| + * Events
|
| + */
|
| +
|
| +/// Fired when a context menu item is clicked.
|
| +class Event_context_menus_onClicked extends Event {
|
| + void addListener(void callback(ContextmenusOnClickData info, Tab tab)) {
|
| + void __proxy_callback(info, tab) {
|
| + if (?callback) {
|
| + callback(new ContextmenusOnClickData._proxy(info), new Tab._proxy(tab));
|
| + }
|
| + }
|
| + super.addListener(callback);
|
| + }
|
| +
|
| + void removeListener(void callback(ContextmenusOnClickData info, Tab tab)) {
|
| + void __proxy_callback(info, tab) {
|
| + if (?callback) {
|
| + callback(new ContextmenusOnClickData._proxy(info), new Tab._proxy(tab));
|
| + }
|
| + }
|
| + super.removeListener(callback);
|
| + }
|
| +
|
| + bool hasListener(void callback(ContextmenusOnClickData info, Tab tab)) {
|
| + void __proxy_callback(info, tab) {
|
| + if (?callback) {
|
| + callback(new ContextmenusOnClickData._proxy(info), new Tab._proxy(tab));
|
| + }
|
| + }
|
| + super.hasListener(callback);
|
| + }
|
| +
|
| + Event_context_menus_onClicked(jsObject) : super._(jsObject, 2);
|
| +}
|
| +
|
| +/**
|
| + * Functions
|
| + */
|
| +
|
| +class API_context_menus {
|
| + /*
|
| + * API connection
|
| + */
|
| + Object _jsObject;
|
| +
|
| + /*
|
| + * Events
|
| + */
|
| + Event_context_menus_onClicked onClicked;
|
| +
|
| + /*
|
| + * Functions
|
| + */
|
| + /// Creates a new context menu item. Note that if an error occurs during
|
| + /// creation, you may not find out until the creation callback fires (the
|
| + /// details will be in chrome.runtime.lastError).
|
| + Object create(Object createProperties, [void callback()]) => JS('Object', '#.create(#, #)', this._jsObject, convertArgument(createProperties), convertDartClosureToJS(callback, 0));
|
| +
|
| + /// Updates a previously created context menu item.
|
| + void update(Object id, Object updateProperties, [void callback()]) => JS('void', '#.update(#, #, #)', this._jsObject, id, convertArgument(updateProperties), convertDartClosureToJS(callback, 0));
|
| +
|
| + /// Removes a context menu item.
|
| + void remove(Object menuItemId, [void callback()]) => JS('void', '#.remove(#, #)', this._jsObject, menuItemId, convertDartClosureToJS(callback, 0));
|
| +
|
| + /// Removes all context menu items added by this extension.
|
| + void removeAll([void callback()]) => JS('void', '#.removeAll(#)', this._jsObject, convertDartClosureToJS(callback, 0));
|
| +
|
| + API_context_menus(this._jsObject) {
|
| + onClicked = new Event_context_menus_onClicked(JS('', '#.onClicked', this._jsObject));
|
| + }
|
| +}
|
|
|