chrome
- Top-Level Variables
-
chrome: API_Chrome
- Functions
-
convertArgument(dynamic argument): Object
- Classes
-
API_Chrome
API_ChromeApp
API_app_runtime
API_app_window
API_file_system
AppRuntimeLaunchData
AppRuntimeLaunchItem
AppWindowAppWindow
AppWindowBounds
AppWindowCreateWindowOptions
ChromeObject
Event
Event_app_runtime_onLaunched
Event_app_runtime_onRestarted
Event_app_window_onBoundsChanged
Event_app_window_onClosed
Event_app_window_onFullscreened
Event_app_window_onMaximized
Event_app_window_onMinimized
Event_app_window_onRestored
FilesystemAcceptOption
FilesystemChooseEntryOptions
Rule
Native wrappers for the Chrome packaged app APIs.
These functions allow direct access to the chrome.* APIs, allowing Chrome packaged apps to be written using Dart.
For more information on these APIs, see the chrome.* API documentation
(http://developer.chrome.com/apps/api_index.html).
Top-Level Variables
Functions
static Object convertArgument(dynamic argument)
Converts the given argument Object to js-friendly format, recursively.
Flattens out all Chrome objects into their corresponding ._toMap() definitions, then converts them to JS objects.
Returns the new argument.
Cannot be used for functions.
Class API_Chrome
- Fields
-
app: API_ChromeApp
fileSystem: API_file_system
- Constructors
-
API_Chrome()
Fields
API_ChromeApp app
API_file_system fileSystem
Constructors
API_Chrome()
Class API_ChromeApp
- Fields
-
runtime: API_app_runtime
window: API_app_window
- Constructors
-
API_ChromeApp(Object _jsObject)
Fields
API_app_runtime runtime
API_app_window window
Constructors
API_ChromeApp(Object _jsObject)
Class API_app_runtime
- Fields
-
onLaunched: Event_app_runtime_onLaunched
onRestarted: Event_app_runtime_onRestarted
- Constructors
-
API_app_runtime(Object _jsObject)
Fields
Event_app_runtime_onLaunched onLaunched
Event_app_runtime_onRestarted onRestarted
Constructors
API_app_runtime(Object _jsObject)
Class API_app_window
- Fields
-
onBoundsChanged: Event_app_window_onBoundsChanged
onClosed: Event_app_window_onClosed
onFullscreened: Event_app_window_onFullscreened
onMaximized: Event_app_window_onMaximized
onMinimized: Event_app_window_onMinimized
onRestored: Event_app_window_onRestored
- Constructors
-
API_app_window(Object _jsObject)
- Methods
-
create(String url, AppWindowCreateWindowOptions options, callback): void
current(): AppWindowAppWindow
initializeAppWindow(Object state): void
Fields
Event_app_window_onBoundsChanged onBoundsChanged
Event_app_window_onClosed onClosed
Event_app_window_onFullscreened onFullscreened
Event_app_window_onMaximized onMaximized
Event_app_window_onMinimized onMinimized
Event_app_window_onRestored onRestored
Constructors
API_app_window(Object _jsObject)
Methods
void create(String url, AppWindowCreateWindowOptions options, callback)
The size and position of a window can be specified in a number of different ways. The most simple option is not specifying anything at all, in which case a default size and platform dependent position will be used.<br/><br/> Another option is to use the bounds property, which will put the window at the specified coordinates with the specified size. If the window has a frame, it's total size will be the size given plus the size of the frame; that is, the size in bounds is the content size, not the window size.<br/><br/> To automatically remember the positions of windows you can give them ids. If a window has an id, This id is used to remember the size and position of the window whenever it is moved or resized. This size and position is then used instead of the specified bounds on subsequent opening of a window with the same id. If you need to open a window with an id at a location other than the remembered default, you can create it hidden, move it to the desired location, then show it.
AppWindowAppWindow current()
Returns an $ref:AppWindow object for the current script context (ie JavaScript 'window' object). This can also be called on a handle to a script context for another page, for example: otherWindow.chrome.app.window.current().
void initializeAppWindow(Object state)
Class API_file_system
- Constructors
-
API_file_system(Object _jsObject)
- Methods
-
chooseEntry( callback, FilesystemChooseEntryOptions options): void
getDisplayPath(FileEntry fileEntry, callback): void
getWritableEntry(FileEntry fileEntry, callback): void
isRestorable(String id, callback): void
isWritableEntry(FileEntry fileEntry, callback): void
restoreEntry(String id, callback): void
retainEntry(FileEntry fileEntry): String
Constructors
API_file_system(Object _jsObject)
Methods
void chooseEntry( callback, FilesystemChooseEntryOptions options)
Ask the user to choose a file.
void getDisplayPath(FileEntry fileEntry, callback)
Get the display path of a FileEntry object. The display path is based on the full path of the file on the local file system, but may be made more readable for display purposes.
void getWritableEntry(FileEntry fileEntry, callback)
Get a writable FileEntry from another FileEntry. This call will fail if the application does not have the 'write' permission under 'fileSystem'.
void isRestorable(String id, callback)
Returns whether a file entry for the given id can be restored, i.e. whether restoreEntry would succeed with this id now.
void isWritableEntry(FileEntry fileEntry, callback)
Gets whether this FileEntry is writable or not.
void restoreEntry(String id, callback)
Returns the file entry with the given id if it can be restored. This call will fail otherwise.
String retainEntry(FileEntry fileEntry)
Returns an id that can be passed to restoreEntry to regain access to a given file entry. Only the 500 most recently used entries are retained, where calls to retainEntry and restoreEntry count as use. If the app has the 'retainEntries' permission under 'fileSystem', entries are retained indefinitely. Otherwise, entries are retained only while the app is running and across restarts.
Class AppRuntimeLaunchData extends ChromeObject
- Fields
-
id: String
items: List
- Getters and Setters
-
id: String
id=(String id)
items: List<AppRuntimeLaunchItem>
items=(List<AppRuntimeLaunchItem> items)
- Constructors
-
AppRuntimeLaunchData(String id, List<AppRuntimeLaunchItem> items)
Fields
String id
List items
Getters and Setters
String get id
The id of the file handler that the app is being invoked with.
set id=(String id)
List<AppRuntimeLaunchItem> get items
set items=(List<AppRuntimeLaunchItem> items)
Constructors
AppRuntimeLaunchData(String id, List<AppRuntimeLaunchItem> items)
Class AppRuntimeLaunchItem extends ChromeObject
- Fields
-
entry: FileEntry
type: String
- Getters and Setters
-
entry: FileEntry
entry=(FileEntry entry)
type: String
type=(String type)
- Constructors
-
AppRuntimeLaunchItem(FileEntry entry, String type)
Fields
FileEntry entry
String type
Getters and Setters
FileEntry get entry
set entry=(FileEntry entry)
String get type
The MIME type of the file.
set type=(String type)
Constructors
AppRuntimeLaunchItem(FileEntry entry, String type)
Class AppWindowAppWindow extends ChromeObject
- Fields
-
contentWindow: WindowBase
- Getters and Setters
-
contentWindow: WindowBase
- Methods
-
clearAttention(): void
close(): void
drawAttention(): void
focus(): void
fullscreen(): void
getBounds(): AppWindowBounds
hide(): void
isFullscreen(): bool
isMaximized(): bool
isMinimized(): bool
maximize(): void
minimize(): void
moveTo(int left, int top): void
resizeTo(int width, int height): void
restore(): void
setBounds(AppWindowBounds bounds): void
setIcon(String icon_url): void
show(): void
Fields
final WindowBase contentWindow
Getters and Setters
WindowBase get contentWindow
The JavaScript 'window' object for the created child.
Methods
void clearAttention()
Clear attention to the window.
void close()
void drawAttention()
Draw attention to the window.
void focus()
void fullscreen()
AppWindowBounds getBounds()
Get the window's bounds as a $ref:Bounds object.
void hide()
Hide the window. Does nothing if the window is already hidden.
bool isFullscreen()
Is the window fullscreen?
bool isMaximized()
bool isMinimized()
void maximize()
void minimize()
void moveTo(int left, int top)
Move the window to the position (|left|, |top|).
void resizeTo(int width, int height)
Resize the window to |width|x|height| pixels in size.
void restore()
Restore the window, exiting a maximized, minimized, or fullscreen state.
void setBounds(AppWindowBounds bounds)
void setIcon(String icon_url)
Set the app icon for the window (experimental). Currently this is only being implemented on Ash. TODO(stevenjb): Investigate implementing this on Windows and OSX.
void show()
Show the window. Does nothing if the window is already visible.
Class AppWindowBounds extends ChromeObject
- Fields
-
height: int
left: int
top: int
width: int
- Getters and Setters
-
height: int
height=(int height)
left: int
left=(int left)
top: int
top=(int top)
width: int
width=(int width)
- Constructors
-
AppWindowBounds(int left, int top, int width, int height)
Fields
int height
int left
int top
int width
Getters and Setters
int get height
set height=(int height)
int get left
set left=(int left)
int get top
set top=(int top)
int get width
set width=(int width)
Constructors
AppWindowBounds(int left, int top, int width, int height)
Class AppWindowCreateWindowOptions extends ChromeObject
- Fields
-
bounds: AppWindowBounds
defaultHeight: int
defaultLeft: int
defaultTop: int
defaultWidth: int
frame: String
height: int
hidden: bool
id: String
left: int
maxHeight: int
maxWidth: int
minHeight: int
minWidth: int
resizable: bool
singleton: bool
state: String
top: int
transparentBackground: bool
type: String
width: int
- Getters and Setters
-
bounds: AppWindowBounds
bounds=(AppWindowBounds bounds)
defaultHeight: int
defaultHeight=(int defaultHeight)
defaultLeft: int
defaultLeft=(int defaultLeft)
defaultTop: int
defaultTop=(int defaultTop)
defaultWidth: int
defaultWidth=(int defaultWidth)
frame: String
frame=(String frame)
height: int
height=(int height)
hidden: bool
hidden=(bool hidden)
id: String
id=(String id)
left: int
left=(int left)
maxHeight: int
maxHeight=(int maxHeight)
maxWidth: int
maxWidth=(int maxWidth)
minHeight: int
minHeight=(int minHeight)
minWidth: int
minWidth=(int minWidth)
resizable: bool
resizable=(bool resizable)
singleton: bool
singleton=(bool singleton)
state: String
state=(String state)
top: int
top=(int top)
transparentBackground: bool
transparentBackground=(bool transparentBackground)
type: String
type=(String type)
width: int
width=(int width)
- Constructors
-
AppWindowCreateWindowOptions(String id, int defaultWidth, int defaultHeight, int defaultLeft, int defaultTop, int width, int height, int left, int top, int minWidth, int minHeight, int maxWidth, int maxHeight, String type, String frame, AppWindowBounds bounds, bool transparentBackground, String state, bool hidden, bool resizable, bool singleton)
Fields
AppWindowBounds bounds
int defaultHeight
int defaultLeft
int defaultTop
int defaultWidth
String frame
int height
bool hidden
String id
int left
int maxHeight
int maxWidth
int minHeight
int minWidth
bool resizable
bool singleton
String state
int top
bool transparentBackground
String type
int width
Getters and Setters
AppWindowBounds get bounds
Size and position of the content in the window (excluding the titlebar). If an id is also specified and a window with a matching id has been shown before, the remembered bounds of the window will be used instead.
set bounds=(AppWindowBounds bounds)
int get defaultHeight
Default height of the window. (Deprecated; regular bounds act like this now.)
set defaultHeight=(int defaultHeight)
int get defaultLeft
Default X coordinate of the window. (Deprecated; regular bounds act like this now.)
set defaultLeft=(int defaultLeft)
int get defaultTop
Default Y coordinate of the window. (Deprecated; regular bounds act like this now.)
set defaultTop=(int defaultTop)
int get defaultWidth
Default width of the window. (Deprecated; regular bounds act like this now.)
set defaultWidth=(int defaultWidth)
String get frame
Frame type: 'none' or 'chrome' (defaults to 'chrome').
set frame=(String frame)
int get height
Height of the window. (Deprecated; use 'bounds'.)
set height=(int height)
bool get hidden
If true, the window will be created in a hidden state. Call show() on the window to show it once it has been created. Defaults to false.
set hidden=(bool hidden)
String get id
Id to identify the window. This will be used to remember the size and position of the window and restore that geometry when a window with the same id is later opened.
set id=(String id)
int get left
X coordinate of the window. (Deprecated; use 'bounds'.)
set left=(int left)
int get maxHeight
Maximum height for the lifetime of the window.
set maxHeight=(int maxHeight)
int get maxWidth
Maximum width for the lifetime of the window.
set maxWidth=(int maxWidth)
int get minHeight
Minimum height for the lifetime of the window.
set minHeight=(int minHeight)
int get minWidth
Minimum width for the lifetime of the window.
set minWidth=(int minWidth)
bool get resizable
If true, the window will be resizable by the user. Defaults to true.
set resizable=(bool resizable)
bool get singleton
By default if you specify an id for the window, the window will only be created if another window with the same id doesn't already exist. If a window with the same id already exists that window is activated instead. If you do want to create multiple windows with the same id, you can set this property to false.
set singleton=(bool singleton)
String get state
The initial state of the window, allowing it to be created already fullscreen, maximized, or minimized. Defaults to 'normal'.
set state=(String state)
int get top
Y coordinate of the window. (Deprecated; use 'bounds'.)
set top=(int top)
bool get transparentBackground
Enable window background transparency. Only supported in ash. Requires experimental API permission.
set transparentBackground=(bool transparentBackground)
String get type
Type of window to create.
set type=(String type)
int get width
Width of the window. (Deprecated; use 'bounds'.)
set width=(int width)
Constructors
AppWindowCreateWindowOptions(String id, int defaultWidth, int defaultHeight, int defaultLeft, int defaultTop, int width, int height, int left, int top, int minWidth, int minHeight, int maxWidth, int maxHeight, String type, String frame, AppWindowBounds bounds, bool transparentBackground, String state, bool hidden, bool resizable, bool singleton)
Abstract class ChromeObject
- Constructors
-
ChromeObject()
A dart object, that is convertible to JS. Used for creating objects in dart, then passing them to JS.
Objects that are passable to JS need to implement this interface.
Constructors
ChromeObject()
Class Event
- Methods
-
addListener(Function callback): void
addRules(String eventName, List<Rule> rules, callback): void
getRules(String eventName, List<String> ruleIdentifiers, callback): void
hasListener(Function callback): bool
hasListeners(): bool
removeListener(Function callback): void
removeRules(String eventName, List<String> ruleIdentifiers, callback): void
The Event class.
Chrome Event classes extend this interface.
e.g.
// chrome.app.runtime.onLaunched class Event_ChromeAppRuntimeOnLaunched extends Event { // constructor, passing the arity of the callback Event_ChromeAppRuntimeOnLaunched(jsObject) :
super._(jsObject, 1);
// methods, strengthening the Function parameter specificity void addListener(void callback(LaunchData launchData))
=> super.addListener(callback);
void removeListener(void callback(LaunchData launchData))
=> super.removeListener(callback);
bool hasListener(void callback(LaunchData launchData))
=> super.hasListener(callback);
}
Methods
void addListener(Function callback)
Registers an event listener <em>callback</em> to an event.
void addRules(String eventName, List<Rule> rules, callback)
Registers rules to handle events.
eventName
is the name of the event this function affects and rules
are the rules to be registered. These do not replace previously registered rules. callback
is called with registered rules.
void getRules(String eventName, List<String> ruleIdentifiers, callback)
Returns currently registered rules.
eventName
is the name of the event this function affects and, if an array is passed as ruleIdentifiers
, only rules with identifiers contained in this array are returned. callback
is called with registered rules.
bool hasListener(Function callback)
Returns True if <em>callback</em> is registered to the event.
bool hasListeners()
Returns true if any event listeners are registered to the event.
void removeListener(Function callback)
Deregisters an event listener <em>callback</em> from an event.
void removeRules(String eventName, List<String> ruleIdentifiers, callback)
Unregisters currently registered rules.
eventName
is the name of the event this function affects and, if an array is passed as ruleIdentifiers
, only rules with identifiers contained in this array are unregistered. callback
is called when the rules are unregistered.
Class Event_app_runtime_onLaunched extends Event
- Constructors
-
Event_app_runtime_onLaunched(dynamic jsObject)
- Methods
-
addListener( callback): void
hasListener( callback): bool
removeListener( callback): void
Fired when an app is launched from the launcher.
Constructors
Event_app_runtime_onLaunched(dynamic jsObject)
Methods
void addListener( callback)
Registers an event listener <em>callback</em> to an event.
bool hasListener( callback)
Returns True if <em>callback</em> is registered to the event.
void removeListener( callback)
Deregisters an event listener <em>callback</em> from an event.
Class Event_app_runtime_onRestarted extends Event
- Constructors
-
Event_app_runtime_onRestarted(dynamic jsObject)
- Methods
-
addListener( callback): void
hasListener( callback): bool
removeListener( callback): void
Fired at Chrome startup to apps that were running when Chrome last shut down.
Constructors
Event_app_runtime_onRestarted(dynamic jsObject)
Methods
void addListener( callback)
Registers an event listener <em>callback</em> to an event.
bool hasListener( callback)
Returns True if <em>callback</em> is registered to the event.
void removeListener( callback)
Deregisters an event listener <em>callback</em> from an event.
Class Event_app_window_onBoundsChanged extends Event
- Constructors
-
Event_app_window_onBoundsChanged(dynamic jsObject)
- Methods
-
addListener( callback): void
hasListener( callback): bool
removeListener( callback): void
Fired when the window is resized.
Constructors
Event_app_window_onBoundsChanged(dynamic jsObject)
Methods
void addListener( callback)
Registers an event listener <em>callback</em> to an event.
bool hasListener( callback)
Returns True if <em>callback</em> is registered to the event.
void removeListener( callback)
Deregisters an event listener <em>callback</em> from an event.
Class Event_app_window_onClosed extends Event
- Constructors
-
Event_app_window_onClosed(dynamic jsObject)
- Methods
-
addListener( callback): void
hasListener( callback): bool
removeListener( callback): void
Fired when the window is closed.
Constructors
Event_app_window_onClosed(dynamic jsObject)
Methods
void addListener( callback)
Registers an event listener <em>callback</em> to an event.
bool hasListener( callback)
Returns True if <em>callback</em> is registered to the event.
void removeListener( callback)
Deregisters an event listener <em>callback</em> from an event.
Class Event_app_window_onFullscreened extends Event
- Constructors
-
Event_app_window_onFullscreened(dynamic jsObject)
- Methods
-
addListener( callback): void
hasListener( callback): bool
removeListener( callback): void
Fired when the window is fullscreened.
Constructors
Event_app_window_onFullscreened(dynamic jsObject)
Methods
void addListener( callback)
Registers an event listener <em>callback</em> to an event.
bool hasListener( callback)
Returns True if <em>callback</em> is registered to the event.
void removeListener( callback)
Deregisters an event listener <em>callback</em> from an event.
Class Event_app_window_onMaximized extends Event
- Constructors
-
Event_app_window_onMaximized(dynamic jsObject)
- Methods
-
addListener( callback): void
hasListener( callback): bool
removeListener( callback): void
Fired when the window is maximized.
Constructors
Event_app_window_onMaximized(dynamic jsObject)
Methods
void addListener( callback)
Registers an event listener <em>callback</em> to an event.
bool hasListener( callback)
Returns True if <em>callback</em> is registered to the event.
void removeListener( callback)
Deregisters an event listener <em>callback</em> from an event.
Class Event_app_window_onMinimized extends Event
- Constructors
-
Event_app_window_onMinimized(dynamic jsObject)
- Methods
-
addListener( callback): void
hasListener( callback): bool
removeListener( callback): void
Fired when the window is minimized.
Constructors
Event_app_window_onMinimized(dynamic jsObject)
Methods
void addListener( callback)
Registers an event listener <em>callback</em> to an event.
bool hasListener( callback)
Returns True if <em>callback</em> is registered to the event.
void removeListener( callback)
Deregisters an event listener <em>callback</em> from an event.
Class Event_app_window_onRestored extends Event
- Constructors
-
Event_app_window_onRestored(dynamic jsObject)
- Methods
-
addListener( callback): void
hasListener( callback): bool
removeListener( callback): void
Fired when the window is restored from being minimized or maximized.
Constructors
Event_app_window_onRestored(dynamic jsObject)
Methods
void addListener( callback)
Registers an event listener <em>callback</em> to an event.
bool hasListener( callback)
Returns True if <em>callback</em> is registered to the event.
void removeListener( callback)
Deregisters an event listener <em>callback</em> from an event.
Class FilesystemAcceptOption extends ChromeObject
- Fields
-
description: String
extensions: List
mimeTypes: List
- Getters and Setters
-
description: String
description=(String description)
extensions: List<String>
extensions=(List<String> extensions)
mimeTypes: List<String>
mimeTypes=(List<String> mimeTypes)
- Constructors
-
FilesystemAcceptOption(String description, List<String> mimeTypes, List<String> extensions)
Fields
String description
List extensions
List mimeTypes
Getters and Setters
String get description
This is the optional text description for this option. If not present, a description will be automatically generated; typically containing an expanded list of valid extensions (e.g. "text/html" may expand to "*.html, *.htm").
set description=(String description)
List<String> get extensions
Extensions to accept, e.g. "jpg", "gif", "crx".
set extensions=(List<String> extensions)
List<String> get mimeTypes
Mime-types to accept, e.g. "image/jpeg" or "audio/*". One of mimeTypes or extensions must contain at least one valid element.
set mimeTypes=(List<String> mimeTypes)
Constructors
FilesystemAcceptOption(String description, List<String> mimeTypes, List<String> extensions)
Class FilesystemChooseEntryOptions extends ChromeObject
- Fields
-
accepts: List
acceptsAllTypes: bool
suggestedName: String
type: String
- Getters and Setters
-
accepts: List<FilesystemAcceptOption>
accepts=(List<FilesystemAcceptOption> accepts)
acceptsAllTypes: bool
acceptsAllTypes=(bool acceptsAllTypes)
suggestedName: String
suggestedName=(String suggestedName)
type: String
type=(String type)
- Constructors
-
FilesystemChooseEntryOptions(String type, String suggestedName, List<FilesystemAcceptOption> accepts, bool acceptsAllTypes)
Fields
List accepts
bool acceptsAllTypes
String suggestedName
String type
Getters and Setters
List<FilesystemAcceptOption> get accepts
The optional list of accept options for this file opener. Each option will be presented as a unique group to the end-user.
set accepts=(List<FilesystemAcceptOption> accepts)
bool get acceptsAllTypes
Whether to accept all file types, in addition to the options specified in the accepts argument. The default is true. If the accepts field is unset or contains no valid entries, this will always be reset to true.
set acceptsAllTypes=(bool acceptsAllTypes)
String get suggestedName
The suggested file name that will be presented to the user as the default name to read or write. This is optional.
set suggestedName=(String suggestedName)
String get type
Type of the prompt to show. The default is 'openFile'.
set type=(String type)
Constructors
FilesystemChooseEntryOptions(String type, String suggestedName, List<FilesystemAcceptOption> accepts, bool acceptsAllTypes)
- Fields
-
actions: List
conditions: List
id: String
priority: int
- Getters and Setters
-
actions: List<dynamic>
actions=(List<dynamic> actions)
conditions: List<dynamic>
conditions=(List<dynamic> conditions)
id: String
id=(String id)
priority: int
priority=(int priority)
- Constructors
-
Rule(String id, List<dynamic> conditions, List<dynamic> actions, int priority)
Description of a declarative rule for handling events.
Fields
List actions
List conditions
String id
int priority
Getters and Setters
List<dynamic> get actions
set actions=(List<dynamic> actions)
List<dynamic> get conditions
set conditions=(List<dynamic> conditions)
String get id
set id=(String id)
int get priority
set priority=(int priority)
Constructors
Rule(String id, List<dynamic> conditions, List<dynamic> actions, int priority)