Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: sdk/lib/_chrome/dart2js/chrome_dart2js.dart

Issue 2754013002: Format all dart: library files (Closed)
Patch Set: Format all dart: library files Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sdk/lib/_chrome/dartium/chrome_dartium.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /// Native wrappers for the Chrome packaged app APIs. 1 /// Native wrappers for the Chrome packaged app APIs.
2 /// 2 ///
3 /// These functions allow direct access to the chrome.* APIs, allowing 3 /// These functions allow direct access to the chrome.* APIs, allowing
4 /// Chrome packaged apps to be written using Dart. 4 /// Chrome packaged apps to be written using Dart.
5 /// 5 ///
6 /// For more information on these APIs, see the 6 /// For more information on these APIs, see the
7 /// [chrome.* API documentation](http://developer.chrome.com/apps/api_index.html ). 7 /// [chrome.* API documentation](http://developer.chrome.com/apps/api_index.html ).
8 library _chrome; 8 library _chrome;
9 9
10 import 'dart:_foreign_helper' show JS; 10 import 'dart:_foreign_helper' show JS;
11 import 'dart:_js_helper'; 11 import 'dart:_js_helper';
12 import 'dart:html_common'; 12 import 'dart:html_common';
13 import 'dart:html'; 13 import 'dart:html';
14 14
15 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 15 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
16 // for details. All rights reserved. Use of this source code is governed by a 16 // for details. All rights reserved. Use of this source code is governed by a
17 // BSD-style license that can be found in the LICENSE file. 17 // BSD-style license that can be found in the LICENSE file.
18 18
19 // DO NOT EDIT 19 // DO NOT EDIT
20 // Auto-generated dart:_chrome library. 20 // Auto-generated dart:_chrome library.
21 21
22
23 /* TODO(sashab): Add "show convertDartClosureToJS" once 'show' works. */ 22 /* TODO(sashab): Add "show convertDartClosureToJS" once 'show' works. */
24 23
25
26 // Generated files below this line. 24 // Generated files below this line.
27 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 25 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
28 // for details. All rights reserved. Use of this source code is governed by a 26 // for details. All rights reserved. Use of this source code is governed by a
29 // BSD-style license that can be found in the LICENSE file. 27 // BSD-style license that can be found in the LICENSE file.
30 28
31 /** 29 /**
32 * A set of utilities for use with the Chrome Extension APIs. 30 * A set of utilities for use with the Chrome Extension APIs.
33 * 31 *
34 * Allows for easy access to required JS objects. 32 * Allows for easy access to required JS objects.
35 */ 33 */
(...skipping 28 matching lines...) Expand all
64 /** 62 /**
65 * Useful functions for converting arguments. 63 * Useful functions for converting arguments.
66 */ 64 */
67 65
68 /** 66 /**
69 * Converts the given map-type argument to js-friendly format, recursively. 67 * Converts the given map-type argument to js-friendly format, recursively.
70 * Returns the new Map object. 68 * Returns the new Map object.
71 */ 69 */
72 Object _convertMapArgument(Map argument) { 70 Object _convertMapArgument(Map argument) {
73 Map m = new Map(); 71 Map m = new Map();
74 for (Object key in argument.keys) 72 for (Object key in argument.keys) m[key] = convertArgument(argument[key]);
75 m[key] = convertArgument(argument[key]);
76 return convertDartToNative_Dictionary(m); 73 return convertDartToNative_Dictionary(m);
77 } 74 }
78 75
79 /** 76 /**
80 * Converts the given list-type argument to js-friendly format, recursively. 77 * Converts the given list-type argument to js-friendly format, recursively.
81 * Returns the new List object. 78 * Returns the new List object.
82 */ 79 */
83 List _convertListArgument(List argument) { 80 List _convertListArgument(List argument) {
84 List l = new List(); 81 List l = new List();
85 for (var i = 0; i < argument.length; i ++) 82 for (var i = 0; i < argument.length; i++) l.add(convertArgument(argument[i]));
86 l.add(convertArgument(argument[i]));
87 return l; 83 return l;
88 } 84 }
89 85
90 /** 86 /**
91 * Converts the given argument Object to js-friendly format, recursively. 87 * Converts the given argument Object to js-friendly format, recursively.
92 * 88 *
93 * Flattens out all Chrome objects into their corresponding ._toMap() 89 * Flattens out all Chrome objects into their corresponding ._toMap()
94 * definitions, then converts them to JS objects. 90 * definitions, then converts them to JS objects.
95 * 91 *
96 * Returns the new argument. 92 * Returns the new argument.
97 * 93 *
98 * Cannot be used for functions. 94 * Cannot be used for functions.
99 */ 95 */
100 Object convertArgument(var argument) { 96 Object convertArgument(var argument) {
101 if (argument == null) 97 if (argument == null) return argument;
102 return argument;
103 98
104 if (argument is num || argument is String || argument is bool) 99 if (argument is num || argument is String || argument is bool)
105 return argument; 100 return argument;
106 101
107 if (argument is ChromeObject) 102 if (argument is ChromeObject) return argument._jsObject;
108 return argument._jsObject;
109 103
110 if (argument is List) 104 if (argument is List) return _convertListArgument(argument);
111 return _convertListArgument(argument);
112 105
113 if (argument is Map) 106 if (argument is Map) return _convertMapArgument(argument);
114 return _convertMapArgument(argument);
115 107
116 if (argument is Function) 108 if (argument is Function)
117 throw new Exception("Cannot serialize Function argument ${argument}."); 109 throw new Exception("Cannot serialize Function argument ${argument}.");
118 110
119 // TODO(sashab): Try and detect whether the argument is already serialized. 111 // TODO(sashab): Try and detect whether the argument is already serialized.
120 return argument; 112 return argument;
121 } 113 }
122 114
123 /// Description of a declarative rule for handling events. 115 /// Description of a declarative rule for handling events.
124 class Rule extends ChromeObject { 116 class Rule extends ChromeObject {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 150
159 void set actions(List actions) { 151 void set actions(List actions) {
160 JS('void', '#.actions = #', this._jsObject, convertArgument(actions)); 152 JS('void', '#.actions = #', this._jsObject, convertArgument(actions));
161 } 153 }
162 154
163 int get priority => JS('int', '#.priority', this._jsObject); 155 int get priority => JS('int', '#.priority', this._jsObject);
164 156
165 void set priority(int priority) { 157 void set priority(int priority) {
166 JS('void', '#.priority = #', this._jsObject, priority); 158 JS('void', '#.priority = #', this._jsObject, priority);
167 } 159 }
168
169 } 160 }
170 161
171 /** 162 /**
172 * The Event class. 163 * The Event class.
173 * 164 *
174 * Chrome Event classes extend this interface. 165 * Chrome Event classes extend this interface.
175 * 166 *
176 * e.g. 167 * e.g.
177 * 168 *
178 * // chrome.app.runtime.onLaunched 169 * // chrome.app.runtime.onLaunched
(...skipping 26 matching lines...) Expand all
205 /* 196 /*
206 * Private constructor 197 * Private constructor
207 */ 198 */
208 Event._(this._jsObject, this._callbackArity); 199 Event._(this._jsObject, this._callbackArity);
209 200
210 /* 201 /*
211 * Methods 202 * Methods
212 */ 203 */
213 204
214 /// Registers an event listener <em>callback</em> to an event. 205 /// Registers an event listener <em>callback</em> to an event.
215 void addListener(Function callback) => 206 void addListener(Function callback) => JS('void', '#.addListener(#)',
216 JS('void', 207 this._jsObject, convertDartClosureToJS(callback, this._callbackArity));
217 '#.addListener(#)',
218 this._jsObject,
219 convertDartClosureToJS(callback, this._callbackArity)
220 );
221 208
222 /// Deregisters an event listener <em>callback</em> from an event. 209 /// Deregisters an event listener <em>callback</em> from an event.
223 void removeListener(Function callback) => 210 void removeListener(Function callback) => JS('void', '#.removeListener(#)',
224 JS('void', 211 this._jsObject, convertDartClosureToJS(callback, this._callbackArity));
225 '#.removeListener(#)',
226 this._jsObject,
227 convertDartClosureToJS(callback, this._callbackArity)
228 );
229 212
230 /// Returns True if <em>callback</em> is registered to the event. 213 /// Returns True if <em>callback</em> is registered to the event.
231 bool hasListener(Function callback) => 214 bool hasListener(Function callback) => JS('bool', '#.hasListener(#)',
232 JS('bool', 215 this._jsObject, convertDartClosureToJS(callback, this._callbackArity));
233 '#.hasListener(#)',
234 this._jsObject,
235 convertDartClosureToJS(callback, this._callbackArity)
236 );
237 216
238 /// Returns true if any event listeners are registered to the event. 217 /// Returns true if any event listeners are registered to the event.
239 bool hasListeners() => 218 bool hasListeners() => JS('bool', '#.hasListeners()', this._jsObject);
240 JS('bool',
241 '#.hasListeners()',
242 this._jsObject
243 );
244 219
245 /// Registers rules to handle events. 220 /// Registers rules to handle events.
246 /// 221 ///
247 /// [eventName] is the name of the event this function affects and [rules] are 222 /// [eventName] is the name of the event this function affects and [rules] are
248 /// the rules to be registered. These do not replace previously registered 223 /// the rules to be registered. These do not replace previously registered
249 /// rules. [callback] is called with registered rules. 224 /// rules. [callback] is called with registered rules.
250 /// 225 ///
251 void addRules(String eventName, List<Rule> rules, 226 void addRules(String eventName, List<Rule> rules,
252 [void callback(List<Rule> rules)]) { 227 [void callback(List<Rule> rules)]) {
253 // proxy the callback 228 // proxy the callback
254 void __proxy_callback(List rules) { 229 void __proxy_callback(List rules) {
255 if (callback != null) { 230 if (callback != null) {
256 List<Rule> __proxy_rules = new List<Rule>(); 231 List<Rule> __proxy_rules = new List<Rule>();
257 232
258 for (Object o in rules) 233 for (Object o in rules) __proxy_rules.add(new Rule._proxy(o));
259 __proxy_rules.add(new Rule._proxy(o));
260 234
261 callback(__proxy_rules); 235 callback(__proxy_rules);
262 } 236 }
263 } 237 }
264 238
265 JS('void', 239 JS(
266 '#.addRules(#, #, #)', 240 'void',
267 this._jsObject, 241 '#.addRules(#, #, #)',
268 convertArgument(eventName), 242 this._jsObject,
269 convertArgument(rules), 243 convertArgument(eventName),
270 convertDartClosureToJS(__proxy_callback, 1) 244 convertArgument(rules),
271 ); 245 convertDartClosureToJS(__proxy_callback, 1));
272 } 246 }
273 247
274 /// Returns currently registered rules. 248 /// Returns currently registered rules.
275 /// 249 ///
276 /// [eventName] is the name of the event this function affects and, if an arra y 250 /// [eventName] is the name of the event this function affects and, if an arra y
277 /// is passed as [ruleIdentifiers], only rules with identifiers contained in 251 /// is passed as [ruleIdentifiers], only rules with identifiers contained in
278 /// this array are returned. [callback] is called with registered rules. 252 /// this array are returned. [callback] is called with registered rules.
279 /// 253 ///
280 void getRules(String eventName, [List<String> ruleIdentifiers, 254 void getRules(String eventName,
281 void callback(List<Rule> rules)]) { 255 [List<String> ruleIdentifiers, void callback(List<Rule> rules)]) {
282 // proxy the callback 256 // proxy the callback
283 void __proxy_callback(List rules) { 257 void __proxy_callback(List rules) {
284 if (callback != null) { 258 if (callback != null) {
285 List<Rule> __proxy_rules = new List<Rule>(); 259 List<Rule> __proxy_rules = new List<Rule>();
286 260
287 for (Object o in rules) 261 for (Object o in rules) __proxy_rules.add(new Rule._proxy(o));
288 __proxy_rules.add(new Rule._proxy(o));
289 262
290 callback(__proxy_rules); 263 callback(__proxy_rules);
291 } 264 }
292 } 265 }
293 266
294 JS('void', 267 JS(
295 '#.getRules(#, #, #)', 268 'void',
296 this._jsObject, 269 '#.getRules(#, #, #)',
297 convertArgument(eventName), 270 this._jsObject,
298 convertArgument(ruleIdentifiers), 271 convertArgument(eventName),
299 convertDartClosureToJS(__proxy_callback, 1) 272 convertArgument(ruleIdentifiers),
300 ); 273 convertDartClosureToJS(__proxy_callback, 1));
301 } 274 }
302 275
303 /// Unregisters currently registered rules. 276 /// Unregisters currently registered rules.
304 /// 277 ///
305 /// [eventName] is the name of the event this function affects and, if an arra y 278 /// [eventName] is the name of the event this function affects and, if an arra y
306 /// is passed as [ruleIdentifiers], only rules with identifiers contained in 279 /// is passed as [ruleIdentifiers], only rules with identifiers contained in
307 /// this array are unregistered. [callback] is called when the rules are 280 /// this array are unregistered. [callback] is called when the rules are
308 /// unregistered. 281 /// unregistered.
309 /// 282 ///
310 void removeRules(String eventName, [List<String> ruleIdentifiers, 283 void removeRules(String eventName,
311 void callback()]) => 284 [List<String> ruleIdentifiers, void callback()]) =>
312 JS('void', 285 JS(
313 '#.removeRules(#, #, #)', 286 'void',
314 this._jsObject, 287 '#.removeRules(#, #, #)',
315 convertArgument(eventName), 288 this._jsObject,
316 convertArgument(ruleIdentifiers), 289 convertArgument(eventName),
317 convertDartClosureToJS(callback, 0) 290 convertArgument(ruleIdentifiers),
318 ); 291 convertDartClosureToJS(callback, 0));
319 } 292 }
320 293
321 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 294 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
322 // for details. All rights reserved. Use of this source code is governed by a 295 // for details. All rights reserved. Use of this source code is governed by a
323 // BSD-style license that can be found in the LICENSE file. 296 // BSD-style license that can be found in the LICENSE file.
324 297
325
326 // chrome.app 298 // chrome.app
327 class API_ChromeApp { 299 class API_ChromeApp {
328 /* 300 /*
329 * JS Variable 301 * JS Variable
330 */ 302 */
331 final Object _jsObject; 303 final Object _jsObject;
332 304
333 /* 305 /*
334 * Members 306 * Members
335 */ 307 */
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 } 358 }
387 359
388 // The final chrome objects 360 // The final chrome objects
389 final API_Chrome chrome = new API_Chrome(); 361 final API_Chrome chrome = new API_Chrome();
390 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 362 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
391 // for details. All rights reserved. Use of this source code is governed by a 363 // for details. All rights reserved. Use of this source code is governed by a
392 // BSD-style license that can be found in the LICENSE file. 364 // BSD-style license that can be found in the LICENSE file.
393 365
394 // Generated from namespace: app.window 366 // Generated from namespace: app.window
395 367
396
397 /** 368 /**
398 * Types 369 * Types
399 */ 370 */
400 371
401 class AppWindowBounds extends ChromeObject { 372 class AppWindowBounds extends ChromeObject {
402 /* 373 /*
403 * Public constructor 374 * Public constructor
404 */ 375 */
405 AppWindowBounds({int left, int top, int width, int height}) { 376 AppWindowBounds({int left, int top, int width, int height}) {
406 if (left != null) 377 if (left != null) this.left = left;
407 this.left = left; 378 if (top != null) this.top = top;
408 if (top != null) 379 if (width != null) this.width = width;
409 this.top = top; 380 if (height != null) this.height = height;
410 if (width != null)
411 this.width = width;
412 if (height != null)
413 this.height = height;
414 } 381 }
415 382
416 /* 383 /*
417 * Private constructor 384 * Private constructor
418 */ 385 */
419 AppWindowBounds._proxy(_jsObject) : super._proxy(_jsObject); 386 AppWindowBounds._proxy(_jsObject) : super._proxy(_jsObject);
420 387
421 /* 388 /*
422 * Public accessors 389 * Public accessors
423 */ 390 */
(...skipping 13 matching lines...) Expand all
437 404
438 void set width(int width) { 405 void set width(int width) {
439 JS('void', '#.width = #', this._jsObject, width); 406 JS('void', '#.width = #', this._jsObject, width);
440 } 407 }
441 408
442 int get height => JS('int', '#.height', this._jsObject); 409 int get height => JS('int', '#.height', this._jsObject);
443 410
444 void set height(int height) { 411 void set height(int height) {
445 JS('void', '#.height = #', this._jsObject, height); 412 JS('void', '#.height = #', this._jsObject, height);
446 } 413 }
447
448 } 414 }
449 415
450 class AppWindowCreateWindowOptions extends ChromeObject { 416 class AppWindowCreateWindowOptions extends ChromeObject {
451 /* 417 /*
452 * Public constructor 418 * Public constructor
453 */ 419 */
454 AppWindowCreateWindowOptions({String id, int defaultWidth, int defaultHeight, int defaultLeft, int defaultTop, int width, int height, int left, int top, int m inWidth, int minHeight, int maxWidth, int maxHeight, String type, String frame, AppWindowBounds bounds, bool transparentBackground, String state, bool hidden, b ool resizable, bool singleton}) { 420 AppWindowCreateWindowOptions(
455 if (id != null) 421 {String id,
456 this.id = id; 422 int defaultWidth,
457 if (defaultWidth != null) 423 int defaultHeight,
458 this.defaultWidth = defaultWidth; 424 int defaultLeft,
459 if (defaultHeight != null) 425 int defaultTop,
460 this.defaultHeight = defaultHeight; 426 int width,
461 if (defaultLeft != null) 427 int height,
462 this.defaultLeft = defaultLeft; 428 int left,
463 if (defaultTop != null) 429 int top,
464 this.defaultTop = defaultTop; 430 int minWidth,
465 if (width != null) 431 int minHeight,
466 this.width = width; 432 int maxWidth,
467 if (height != null) 433 int maxHeight,
468 this.height = height; 434 String type,
469 if (left != null) 435 String frame,
470 this.left = left; 436 AppWindowBounds bounds,
471 if (top != null) 437 bool transparentBackground,
472 this.top = top; 438 String state,
473 if (minWidth != null) 439 bool hidden,
474 this.minWidth = minWidth; 440 bool resizable,
475 if (minHeight != null) 441 bool singleton}) {
476 this.minHeight = minHeight; 442 if (id != null) this.id = id;
477 if (maxWidth != null) 443 if (defaultWidth != null) this.defaultWidth = defaultWidth;
478 this.maxWidth = maxWidth; 444 if (defaultHeight != null) this.defaultHeight = defaultHeight;
479 if (maxHeight != null) 445 if (defaultLeft != null) this.defaultLeft = defaultLeft;
480 this.maxHeight = maxHeight; 446 if (defaultTop != null) this.defaultTop = defaultTop;
481 if (type != null) 447 if (width != null) this.width = width;
482 this.type = type; 448 if (height != null) this.height = height;
483 if (frame != null) 449 if (left != null) this.left = left;
484 this.frame = frame; 450 if (top != null) this.top = top;
485 if (bounds != null) 451 if (minWidth != null) this.minWidth = minWidth;
486 this.bounds = bounds; 452 if (minHeight != null) this.minHeight = minHeight;
453 if (maxWidth != null) this.maxWidth = maxWidth;
454 if (maxHeight != null) this.maxHeight = maxHeight;
455 if (type != null) this.type = type;
456 if (frame != null) this.frame = frame;
457 if (bounds != null) this.bounds = bounds;
487 if (transparentBackground != null) 458 if (transparentBackground != null)
488 this.transparentBackground = transparentBackground; 459 this.transparentBackground = transparentBackground;
489 if (state != null) 460 if (state != null) this.state = state;
490 this.state = state; 461 if (hidden != null) this.hidden = hidden;
491 if (hidden != null) 462 if (resizable != null) this.resizable = resizable;
492 this.hidden = hidden; 463 if (singleton != null) this.singleton = singleton;
493 if (resizable != null)
494 this.resizable = resizable;
495 if (singleton != null)
496 this.singleton = singleton;
497 } 464 }
498 465
499 /* 466 /*
500 * Private constructor 467 * Private constructor
501 */ 468 */
502 AppWindowCreateWindowOptions._proxy(_jsObject) : super._proxy(_jsObject); 469 AppWindowCreateWindowOptions._proxy(_jsObject) : super._proxy(_jsObject);
503 470
504 /* 471 /*
505 * Public accessors 472 * Public accessors
506 */ 473 */
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 /// Frame type: 'none' or 'chrome' (defaults to 'chrome'). 578 /// Frame type: 'none' or 'chrome' (defaults to 'chrome').
612 String get frame => JS('String', '#.frame', this._jsObject); 579 String get frame => JS('String', '#.frame', this._jsObject);
613 580
614 void set frame(String frame) { 581 void set frame(String frame) {
615 JS('void', '#.frame = #', this._jsObject, frame); 582 JS('void', '#.frame = #', this._jsObject, frame);
616 } 583 }
617 584
618 /// Size and position of the content in the window (excluding the titlebar). I f 585 /// Size and position of the content in the window (excluding the titlebar). I f
619 /// an id is also specified and a window with a matching id has been shown 586 /// an id is also specified and a window with a matching id has been shown
620 /// before, the remembered bounds of the window will be used instead. 587 /// before, the remembered bounds of the window will be used instead.
621 AppWindowBounds get bounds => new AppWindowBounds._proxy(JS('', '#.bounds', th is._jsObject)); 588 AppWindowBounds get bounds =>
589 new AppWindowBounds._proxy(JS('', '#.bounds', this._jsObject));
622 590
623 void set bounds(AppWindowBounds bounds) { 591 void set bounds(AppWindowBounds bounds) {
624 JS('void', '#.bounds = #', this._jsObject, convertArgument(bounds)); 592 JS('void', '#.bounds = #', this._jsObject, convertArgument(bounds));
625 } 593 }
626 594
627 /// Enable window background transparency. Only supported in ash. Requires 595 /// Enable window background transparency. Only supported in ash. Requires
628 /// experimental API permission. 596 /// experimental API permission.
629 bool get transparentBackground => JS('bool', '#.transparentBackground', this._ jsObject); 597 bool get transparentBackground =>
598 JS('bool', '#.transparentBackground', this._jsObject);
630 599
631 void set transparentBackground(bool transparentBackground) { 600 void set transparentBackground(bool transparentBackground) {
632 JS('void', '#.transparentBackground = #', this._jsObject, transparentBackgro und); 601 JS('void', '#.transparentBackground = #', this._jsObject,
602 transparentBackground);
633 } 603 }
634 604
635 /// The initial state of the window, allowing it to be created already 605 /// The initial state of the window, allowing it to be created already
636 /// fullscreen, maximized, or minimized. Defaults to 'normal'. 606 /// fullscreen, maximized, or minimized. Defaults to 'normal'.
637 String get state => JS('String', '#.state', this._jsObject); 607 String get state => JS('String', '#.state', this._jsObject);
638 608
639 void set state(String state) { 609 void set state(String state) {
640 JS('void', '#.state = #', this._jsObject, state); 610 JS('void', '#.state = #', this._jsObject, state);
641 } 611 }
642 612
(...skipping 15 matching lines...) Expand all
658 /// By default if you specify an id for the window, the window will only be 628 /// By default if you specify an id for the window, the window will only be
659 /// created if another window with the same id doesn't already exist. If a 629 /// created if another window with the same id doesn't already exist. If a
660 /// window with the same id already exists that window is activated instead. I f 630 /// window with the same id already exists that window is activated instead. I f
661 /// you do want to create multiple windows with the same id, you can set this 631 /// you do want to create multiple windows with the same id, you can set this
662 /// property to false. 632 /// property to false.
663 bool get singleton => JS('bool', '#.singleton', this._jsObject); 633 bool get singleton => JS('bool', '#.singleton', this._jsObject);
664 634
665 void set singleton(bool singleton) { 635 void set singleton(bool singleton) {
666 JS('void', '#.singleton = #', this._jsObject, singleton); 636 JS('void', '#.singleton = #', this._jsObject, singleton);
667 } 637 }
668
669 } 638 }
670 639
671 class AppWindowAppWindow extends ChromeObject { 640 class AppWindowAppWindow extends ChromeObject {
672 /* 641 /*
673 * Private constructor 642 * Private constructor
674 */ 643 */
675 AppWindowAppWindow._proxy(_jsObject) : super._proxy(_jsObject); 644 AppWindowAppWindow._proxy(_jsObject) : super._proxy(_jsObject);
676 645
677 /* 646 /*
678 * Public accessors 647 * Public accessors
679 */ 648 */
680 /// The JavaScript 'window' object for the created child. 649 /// The JavaScript 'window' object for the created child.
681 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 650 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
682 // for details. All rights reserved. Use of this source code is governed by a 651 // for details. All rights reserved. Use of this source code is governed by a
683 // BSD-style license that can be found in the LICENSE file. 652 // BSD-style license that can be found in the LICENSE file.
684 653
685 // TODO(sashab, sra): Detect whether this is the current window, or an 654 // TODO(sashab, sra): Detect whether this is the current window, or an
686 // external one, and return an appropriately-typed object 655 // external one, and return an appropriately-typed object
687 WindowBase get contentWindow => 656 WindowBase get contentWindow =>
688 JS("Window", "#.contentWindow", this._jsObject); 657 JS("Window", "#.contentWindow", this._jsObject);
689 658
690 /* 659 /*
691 * Methods 660 * Methods
692 */ 661 */
693 /// Focus the window. 662 /// Focus the window.
694 void focus() => JS('void', '#.focus()', this._jsObject); 663 void focus() => JS('void', '#.focus()', this._jsObject);
695 664
696 /// Fullscreens the window. 665 /// Fullscreens the window.
697 void fullscreen() => JS('void', '#.fullscreen()', this._jsObject); 666 void fullscreen() => JS('void', '#.fullscreen()', this._jsObject);
698 667
699 /// Is the window fullscreen? 668 /// Is the window fullscreen?
700 bool isFullscreen() => JS('bool', '#.isFullscreen()', this._jsObject); 669 bool isFullscreen() => JS('bool', '#.isFullscreen()', this._jsObject);
701 670
702 /// Minimize the window. 671 /// Minimize the window.
703 void minimize() => JS('void', '#.minimize()', this._jsObject); 672 void minimize() => JS('void', '#.minimize()', this._jsObject);
704 673
705 /// Is the window minimized? 674 /// Is the window minimized?
706 bool isMinimized() => JS('bool', '#.isMinimized()', this._jsObject); 675 bool isMinimized() => JS('bool', '#.isMinimized()', this._jsObject);
707 676
708 /// Maximize the window. 677 /// Maximize the window.
709 void maximize() => JS('void', '#.maximize()', this._jsObject); 678 void maximize() => JS('void', '#.maximize()', this._jsObject);
710 679
711 /// Is the window maximized? 680 /// Is the window maximized?
712 bool isMaximized() => JS('bool', '#.isMaximized()', this._jsObject); 681 bool isMaximized() => JS('bool', '#.isMaximized()', this._jsObject);
713 682
714 /// Restore the window, exiting a maximized, minimized, or fullscreen state. 683 /// Restore the window, exiting a maximized, minimized, or fullscreen state.
715 void restore() => JS('void', '#.restore()', this._jsObject); 684 void restore() => JS('void', '#.restore()', this._jsObject);
716 685
717 /// Move the window to the position (|left|, |top|). 686 /// Move the window to the position (|left|, |top|).
718 void moveTo(int left, int top) => JS('void', '#.moveTo(#, #)', this._jsObject, left, top); 687 void moveTo(int left, int top) =>
688 JS('void', '#.moveTo(#, #)', this._jsObject, left, top);
719 689
720 /// Resize the window to |width|x|height| pixels in size. 690 /// Resize the window to |width|x|height| pixels in size.
721 void resizeTo(int width, int height) => JS('void', '#.resizeTo(#, #)', this._j sObject, width, height); 691 void resizeTo(int width, int height) =>
692 JS('void', '#.resizeTo(#, #)', this._jsObject, width, height);
722 693
723 /// Draw attention to the window. 694 /// Draw attention to the window.
724 void drawAttention() => JS('void', '#.drawAttention()', this._jsObject); 695 void drawAttention() => JS('void', '#.drawAttention()', this._jsObject);
725 696
726 /// Clear attention to the window. 697 /// Clear attention to the window.
727 void clearAttention() => JS('void', '#.clearAttention()', this._jsObject); 698 void clearAttention() => JS('void', '#.clearAttention()', this._jsObject);
728 699
729 /// Close the window. 700 /// Close the window.
730 void close() => JS('void', '#.close()', this._jsObject); 701 void close() => JS('void', '#.close()', this._jsObject);
731 702
732 /// Show the window. Does nothing if the window is already visible. 703 /// Show the window. Does nothing if the window is already visible.
733 void show() => JS('void', '#.show()', this._jsObject); 704 void show() => JS('void', '#.show()', this._jsObject);
734 705
735 /// Hide the window. Does nothing if the window is already hidden. 706 /// Hide the window. Does nothing if the window is already hidden.
736 void hide() => JS('void', '#.hide()', this._jsObject); 707 void hide() => JS('void', '#.hide()', this._jsObject);
737 708
738 /// Get the window's bounds as a $ref:Bounds object. 709 /// Get the window's bounds as a $ref:Bounds object.
739 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 710 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
740 // for details. All rights reserved. Use of this source code is governed by a 711 // for details. All rights reserved. Use of this source code is governed by a
741 // BSD-style license that can be found in the LICENSE file. 712 // BSD-style license that can be found in the LICENSE file.
742 713
743 // TODO(sashab, kalman): Fix IDL parser to read function return values 714 // TODO(sashab, kalman): Fix IDL parser to read function return values
744 // correctly. Currently, it just reads void for all functions. 715 // correctly. Currently, it just reads void for all functions.
745 AppWindowBounds getBounds() => 716 AppWindowBounds getBounds() =>
746 new AppWindowBounds._proxy(JS('void', '#.getBounds()', this._jsObject)); 717 new AppWindowBounds._proxy(JS('void', '#.getBounds()', this._jsObject));
747 718
748 /// Set the window's bounds. 719 /// Set the window's bounds.
749 void setBounds(AppWindowBounds bounds) => JS('void', '#.setBounds(#)', this._j sObject, convertArgument(bounds)); 720 void setBounds(AppWindowBounds bounds) =>
721 JS('void', '#.setBounds(#)', this._jsObject, convertArgument(bounds));
750 722
751 /// Set the app icon for the window (experimental). Currently this is only 723 /// Set the app icon for the window (experimental). Currently this is only
752 /// being implemented on Ash. TODO(stevenjb): Investigate implementing this on 724 /// being implemented on Ash. TODO(stevenjb): Investigate implementing this on
753 /// Windows and OSX. 725 /// Windows and OSX.
754 void setIcon(String icon_url) => JS('void', '#.setIcon(#)', this._jsObject, ic on_url); 726 void setIcon(String icon_url) =>
755 727 JS('void', '#.setIcon(#)', this._jsObject, icon_url);
756 } 728 }
757 729
758 /** 730 /**
759 * Events 731 * Events
760 */ 732 */
761 733
762 /// Fired when the window is resized. 734 /// Fired when the window is resized.
763 class Event_app_window_onBoundsChanged extends Event { 735 class Event_app_window_onBoundsChanged extends Event {
764 void addListener(void callback()) => super.addListener(callback); 736 void addListener(void callback()) => super.addListener(callback);
765 737
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 /// position is then used instead of the specified bounds on subsequent openin g 833 /// position is then used instead of the specified bounds on subsequent openin g
862 /// of a window with the same id. If you need to open a window with an id at a 834 /// of a window with the same id. If you need to open a window with an id at a
863 /// location other than the remembered default, you can create it hidden, move 835 /// location other than the remembered default, you can create it hidden, move
864 /// it to the desired location, then show it. 836 /// it to the desired location, then show it.
865 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 837 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
866 // for details. All rights reserved. Use of this source code is governed by a 838 // for details. All rights reserved. Use of this source code is governed by a
867 // BSD-style license that can be found in the LICENSE file. 839 // BSD-style license that can be found in the LICENSE file.
868 840
869 // TODO(sashab): This override is no longer needed once prefixes are removed. 841 // TODO(sashab): This override is no longer needed once prefixes are removed.
870 void create(String url, 842 void create(String url,
871 [AppWindowCreateWindowOptions options, 843 [AppWindowCreateWindowOptions options,
872 void callback(AppWindowAppWindow created_window)]) { 844 void callback(AppWindowAppWindow created_window)]) {
873 void __proxy_callback(created_window) { 845 void __proxy_callback(created_window) {
874 if (callback != null) 846 if (callback != null)
875 callback(new AppWindowAppWindow._proxy(created_window)); 847 callback(new AppWindowAppWindow._proxy(created_window));
876 } 848 }
877 JS('void', '#.create(#, #, #)', this._jsObject, url, convertArgument(options ), 849
878 convertDartClosureToJS(__proxy_callback, 1)); 850 JS('void', '#.create(#, #, #)', this._jsObject, url,
851 convertArgument(options), convertDartClosureToJS(__proxy_callback, 1));
879 } 852 }
880 853
881 /// Returns an $ref:AppWindow object for the current script context (ie 854 /// Returns an $ref:AppWindow object for the current script context (ie
882 /// JavaScript 'window' object). This can also be called on a handle to a 855 /// JavaScript 'window' object). This can also be called on a handle to a
883 /// script context for another page, for example: 856 /// script context for another page, for example:
884 /// otherWindow.chrome.app.window.current(). 857 /// otherWindow.chrome.app.window.current().
885 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 858 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
886 // for details. All rights reserved. Use of this source code is governed by a 859 // for details. All rights reserved. Use of this source code is governed by a
887 // BSD-style license that can be found in the LICENSE file. 860 // BSD-style license that can be found in the LICENSE file.
888 861
889 // TODO(sashab, kalman): Fix IDL parser to read function return values 862 // TODO(sashab, kalman): Fix IDL parser to read function return values
890 // correctly. Currently, it just reads void for all functions. 863 // correctly. Currently, it just reads void for all functions.
891 AppWindowAppWindow current() => 864 AppWindowAppWindow current() =>
892 new AppWindowAppWindow._proxy(JS('void', '#.current()', this._jsObject)); 865 new AppWindowAppWindow._proxy(JS('void', '#.current()', this._jsObject));
893 866
894 void initializeAppWindow(Object state) => JS('void', '#.initializeAppWindow(#) ', this._jsObject, convertArgument(state)); 867 void initializeAppWindow(Object state) => JS('void',
868 '#.initializeAppWindow(#)', this._jsObject, convertArgument(state));
895 869
896 API_app_window(this._jsObject) { 870 API_app_window(this._jsObject) {
897 onBoundsChanged = new Event_app_window_onBoundsChanged(JS('', '#.onBoundsCha nged', this._jsObject)); 871 onBoundsChanged = new Event_app_window_onBoundsChanged(
898 onClosed = new Event_app_window_onClosed(JS('', '#.onClosed', this._jsObject )); 872 JS('', '#.onBoundsChanged', this._jsObject));
899 onFullscreened = new Event_app_window_onFullscreened(JS('', '#.onFullscreene d', this._jsObject)); 873 onClosed =
900 onMaximized = new Event_app_window_onMaximized(JS('', '#.onMaximized', this. _jsObject)); 874 new Event_app_window_onClosed(JS('', '#.onClosed', this._jsObject));
901 onMinimized = new Event_app_window_onMinimized(JS('', '#.onMinimized', this. _jsObject)); 875 onFullscreened = new Event_app_window_onFullscreened(
902 onRestored = new Event_app_window_onRestored(JS('', '#.onRestored', this._js Object)); 876 JS('', '#.onFullscreened', this._jsObject));
877 onMaximized = new Event_app_window_onMaximized(
878 JS('', '#.onMaximized', this._jsObject));
879 onMinimized = new Event_app_window_onMinimized(
880 JS('', '#.onMinimized', this._jsObject));
881 onRestored =
882 new Event_app_window_onRestored(JS('', '#.onRestored', this._jsObject));
903 } 883 }
904 } 884 }
905 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 885 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
906 // for details. All rights reserved. Use of this source code is governed by a 886 // for details. All rights reserved. Use of this source code is governed by a
907 // BSD-style license that can be found in the LICENSE file. 887 // BSD-style license that can be found in the LICENSE file.
908 888
909 // Generated from namespace: app.runtime 889 // Generated from namespace: app.runtime
910 890
911
912 /** 891 /**
913 * Types 892 * Types
914 */ 893 */
915 894
916 class AppRuntimeLaunchItem extends ChromeObject { 895 class AppRuntimeLaunchItem extends ChromeObject {
917 /* 896 /*
918 * Public constructor 897 * Public constructor
919 */ 898 */
920 AppRuntimeLaunchItem({FileEntry entry, String type}) { 899 AppRuntimeLaunchItem({FileEntry entry, String type}) {
921 if (entry != null) 900 if (entry != null) this.entry = entry;
922 this.entry = entry; 901 if (type != null) this.type = type;
923 if (type != null)
924 this.type = type;
925 } 902 }
926 903
927 /* 904 /*
928 * Private constructor 905 * Private constructor
929 */ 906 */
930 AppRuntimeLaunchItem._proxy(_jsObject) : super._proxy(_jsObject); 907 AppRuntimeLaunchItem._proxy(_jsObject) : super._proxy(_jsObject);
931 908
932 /* 909 /*
933 * Public accessors 910 * Public accessors
934 */ 911 */
935 /// FileEntry for the file. 912 /// FileEntry for the file.
936 FileEntry get entry => JS('FileEntry', '#.entry', this._jsObject); 913 FileEntry get entry => JS('FileEntry', '#.entry', this._jsObject);
937 914
938 void set entry(FileEntry entry) { 915 void set entry(FileEntry entry) {
939 JS('void', '#.entry = #', this._jsObject, convertArgument(entry)); 916 JS('void', '#.entry = #', this._jsObject, convertArgument(entry));
940 } 917 }
941 918
942 /// The MIME type of the file. 919 /// The MIME type of the file.
943 String get type => JS('String', '#.type', this._jsObject); 920 String get type => JS('String', '#.type', this._jsObject);
944 921
945 void set type(String type) { 922 void set type(String type) {
946 JS('void', '#.type = #', this._jsObject, type); 923 JS('void', '#.type = #', this._jsObject, type);
947 } 924 }
948
949 } 925 }
950 926
951 class AppRuntimeLaunchData extends ChromeObject { 927 class AppRuntimeLaunchData extends ChromeObject {
952 /* 928 /*
953 * Public constructor 929 * Public constructor
954 */ 930 */
955 AppRuntimeLaunchData({String id, List<AppRuntimeLaunchItem> items}) { 931 AppRuntimeLaunchData({String id, List<AppRuntimeLaunchItem> items}) {
956 if (id != null) 932 if (id != null) this.id = id;
957 this.id = id; 933 if (items != null) this.items = items;
958 if (items != null)
959 this.items = items;
960 } 934 }
961 935
962 /* 936 /*
963 * Private constructor 937 * Private constructor
964 */ 938 */
965 AppRuntimeLaunchData._proxy(_jsObject) : super._proxy(_jsObject); 939 AppRuntimeLaunchData._proxy(_jsObject) : super._proxy(_jsObject);
966 940
967 /* 941 /*
968 * Public accessors 942 * Public accessors
969 */ 943 */
(...skipping 10 matching lines...) Expand all
980 for (int i = 0; i < count; i++) { 954 for (int i = 0; i < count; i++) {
981 var item = JS('', '#.items[#]', this._jsObject, i); 955 var item = JS('', '#.items[#]', this._jsObject, i);
982 __proxy_items.add(new AppRuntimeLaunchItem._proxy(item)); 956 __proxy_items.add(new AppRuntimeLaunchItem._proxy(item));
983 } 957 }
984 return __proxy_items; 958 return __proxy_items;
985 } 959 }
986 960
987 void set items(List<AppRuntimeLaunchItem> items) { 961 void set items(List<AppRuntimeLaunchItem> items) {
988 JS('void', '#.items = #', this._jsObject, convertArgument(items)); 962 JS('void', '#.items = #', this._jsObject, convertArgument(items));
989 } 963 }
990
991 } 964 }
992 965
993 /** 966 /**
994 * Events 967 * Events
995 */ 968 */
996 969
997 /// Fired when an app is launched from the launcher. 970 /// Fired when an app is launched from the launcher.
998 class Event_app_runtime_onLaunched extends Event { 971 class Event_app_runtime_onLaunched extends Event {
999 void addListener(void callback(AppRuntimeLaunchData launchData)) { 972 void addListener(void callback(AppRuntimeLaunchData launchData)) {
1000 void __proxy_callback(launchData) { 973 void __proxy_callback(launchData) {
1001 if (callback != null) { 974 if (callback != null) {
1002 callback(new AppRuntimeLaunchData._proxy(launchData)); 975 callback(new AppRuntimeLaunchData._proxy(launchData));
1003 } 976 }
1004 } 977 }
978
1005 super.addListener(__proxy_callback); 979 super.addListener(__proxy_callback);
1006 } 980 }
1007 981
1008 void removeListener(void callback(AppRuntimeLaunchData launchData)) { 982 void removeListener(void callback(AppRuntimeLaunchData launchData)) {
1009 void __proxy_callback(launchData) { 983 void __proxy_callback(launchData) {
1010 if (callback != null) { 984 if (callback != null) {
1011 callback(new AppRuntimeLaunchData._proxy(launchData)); 985 callback(new AppRuntimeLaunchData._proxy(launchData));
1012 } 986 }
1013 } 987 }
988
1014 super.removeListener(__proxy_callback); 989 super.removeListener(__proxy_callback);
1015 } 990 }
1016 991
1017 bool hasListener(void callback(AppRuntimeLaunchData launchData)) { 992 bool hasListener(void callback(AppRuntimeLaunchData launchData)) {
1018 void __proxy_callback(launchData) { 993 void __proxy_callback(launchData) {
1019 if (callback != null) { 994 if (callback != null) {
1020 callback(new AppRuntimeLaunchData._proxy(launchData)); 995 callback(new AppRuntimeLaunchData._proxy(launchData));
1021 } 996 }
1022 } 997 }
998
1023 super.hasListener(__proxy_callback); 999 super.hasListener(__proxy_callback);
1024 } 1000 }
1025 1001
1026 Event_app_runtime_onLaunched(jsObject) : super._(jsObject, 1); 1002 Event_app_runtime_onLaunched(jsObject) : super._(jsObject, 1);
1027 } 1003 }
1028 1004
1029 /// Fired at Chrome startup to apps that were running when Chrome last shut 1005 /// Fired at Chrome startup to apps that were running when Chrome last shut
1030 /// down. 1006 /// down.
1031 class Event_app_runtime_onRestarted extends Event { 1007 class Event_app_runtime_onRestarted extends Event {
1032 void addListener(void callback()) => super.addListener(callback); 1008 void addListener(void callback()) => super.addListener(callback);
(...skipping 14 matching lines...) Expand all
1047 * API connection 1023 * API connection
1048 */ 1024 */
1049 Object _jsObject; 1025 Object _jsObject;
1050 1026
1051 /* 1027 /*
1052 * Events 1028 * Events
1053 */ 1029 */
1054 Event_app_runtime_onLaunched onLaunched; 1030 Event_app_runtime_onLaunched onLaunched;
1055 Event_app_runtime_onRestarted onRestarted; 1031 Event_app_runtime_onRestarted onRestarted;
1056 API_app_runtime(this._jsObject) { 1032 API_app_runtime(this._jsObject) {
1057 onLaunched = new Event_app_runtime_onLaunched(JS('', '#.onLaunched', this._j sObject)); 1033 onLaunched = new Event_app_runtime_onLaunched(
1058 onRestarted = new Event_app_runtime_onRestarted(JS('', '#.onRestarted', this ._jsObject)); 1034 JS('', '#.onLaunched', this._jsObject));
1035 onRestarted = new Event_app_runtime_onRestarted(
1036 JS('', '#.onRestarted', this._jsObject));
1059 } 1037 }
1060 } 1038 }
1061 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1039 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
1062 // for details. All rights reserved. Use of this source code is governed by a 1040 // for details. All rights reserved. Use of this source code is governed by a
1063 // BSD-style license that can be found in the LICENSE file. 1041 // BSD-style license that can be found in the LICENSE file.
1064 1042
1065 // Generated from namespace: fileSystem 1043 // Generated from namespace: fileSystem
1066 1044
1067
1068 /** 1045 /**
1069 * Types 1046 * Types
1070 */ 1047 */
1071 1048
1072 class FilesystemAcceptOption extends ChromeObject { 1049 class FilesystemAcceptOption extends ChromeObject {
1073 /* 1050 /*
1074 * Public constructor 1051 * Public constructor
1075 */ 1052 */
1076 FilesystemAcceptOption({String description, List<String> mimeTypes, List<Strin g> extensions}) { 1053 FilesystemAcceptOption(
1077 if (description != null) 1054 {String description, List<String> mimeTypes, List<String> extensions}) {
1078 this.description = description; 1055 if (description != null) this.description = description;
1079 if (mimeTypes != null) 1056 if (mimeTypes != null) this.mimeTypes = mimeTypes;
1080 this.mimeTypes = mimeTypes; 1057 if (extensions != null) this.extensions = extensions;
1081 if (extensions != null)
1082 this.extensions = extensions;
1083 } 1058 }
1084 1059
1085 /* 1060 /*
1086 * Private constructor 1061 * Private constructor
1087 */ 1062 */
1088 FilesystemAcceptOption._proxy(_jsObject) : super._proxy(_jsObject); 1063 FilesystemAcceptOption._proxy(_jsObject) : super._proxy(_jsObject);
1089 1064
1090 /* 1065 /*
1091 * Public accessors 1066 * Public accessors
1092 */ 1067 */
1093 /// This is the optional text description for this option. If not present, a 1068 /// This is the optional text description for this option. If not present, a
1094 /// description will be automatically generated; typically containing an 1069 /// description will be automatically generated; typically containing an
1095 /// expanded list of valid extensions (e.g. "text/html" may expand to "*.html, 1070 /// expanded list of valid extensions (e.g. "text/html" may expand to "*.html,
1096 /// *.htm"). 1071 /// *.htm").
1097 String get description => JS('String', '#.description', this._jsObject); 1072 String get description => JS('String', '#.description', this._jsObject);
1098 1073
1099 void set description(String description) { 1074 void set description(String description) {
1100 JS('void', '#.description = #', this._jsObject, description); 1075 JS('void', '#.description = #', this._jsObject, description);
1101 } 1076 }
1102 1077
1103 /// Mime-types to accept, e.g. "image/jpeg" or "audio/*". One of mimeTypes or 1078 /// Mime-types to accept, e.g. "image/jpeg" or "audio/*". One of mimeTypes or
1104 /// extensions must contain at least one valid element. 1079 /// extensions must contain at least one valid element.
1105 List<String> get mimeTypes => JS('List<String>', '#.mimeTypes', this._jsObject ); 1080 List<String> get mimeTypes =>
1081 JS('List<String>', '#.mimeTypes', this._jsObject);
1106 1082
1107 void set mimeTypes(List<String> mimeTypes) { 1083 void set mimeTypes(List<String> mimeTypes) {
1108 JS('void', '#.mimeTypes = #', this._jsObject, mimeTypes); 1084 JS('void', '#.mimeTypes = #', this._jsObject, mimeTypes);
1109 } 1085 }
1110 1086
1111 /// Extensions to accept, e.g. "jpg", "gif", "crx". 1087 /// Extensions to accept, e.g. "jpg", "gif", "crx".
1112 List<String> get extensions => JS('List<String>', '#.extensions', this._jsObje ct); 1088 List<String> get extensions =>
1089 JS('List<String>', '#.extensions', this._jsObject);
1113 1090
1114 void set extensions(List<String> extensions) { 1091 void set extensions(List<String> extensions) {
1115 JS('void', '#.extensions = #', this._jsObject, extensions); 1092 JS('void', '#.extensions = #', this._jsObject, extensions);
1116 } 1093 }
1117
1118 } 1094 }
1119 1095
1120 class FilesystemChooseEntryOptions extends ChromeObject { 1096 class FilesystemChooseEntryOptions extends ChromeObject {
1121 /* 1097 /*
1122 * Public constructor 1098 * Public constructor
1123 */ 1099 */
1124 FilesystemChooseEntryOptions({String type, String suggestedName, List<Filesyst emAcceptOption> accepts, bool acceptsAllTypes}) { 1100 FilesystemChooseEntryOptions(
1125 if (type != null) 1101 {String type,
1126 this.type = type; 1102 String suggestedName,
1127 if (suggestedName != null) 1103 List<FilesystemAcceptOption> accepts,
1128 this.suggestedName = suggestedName; 1104 bool acceptsAllTypes}) {
1129 if (accepts != null) 1105 if (type != null) this.type = type;
1130 this.accepts = accepts; 1106 if (suggestedName != null) this.suggestedName = suggestedName;
1131 if (acceptsAllTypes != null) 1107 if (accepts != null) this.accepts = accepts;
1132 this.acceptsAllTypes = acceptsAllTypes; 1108 if (acceptsAllTypes != null) this.acceptsAllTypes = acceptsAllTypes;
1133 } 1109 }
1134 1110
1135 /* 1111 /*
1136 * Private constructor 1112 * Private constructor
1137 */ 1113 */
1138 FilesystemChooseEntryOptions._proxy(_jsObject) : super._proxy(_jsObject); 1114 FilesystemChooseEntryOptions._proxy(_jsObject) : super._proxy(_jsObject);
1139 1115
1140 /* 1116 /*
1141 * Public accessors 1117 * Public accessors
1142 */ 1118 */
1143 /// Type of the prompt to show. The default is 'openFile'. 1119 /// Type of the prompt to show. The default is 'openFile'.
1144 String get type => JS('String', '#.type', this._jsObject); 1120 String get type => JS('String', '#.type', this._jsObject);
1145 1121
1146 void set type(String type) { 1122 void set type(String type) {
1147 JS('void', '#.type = #', this._jsObject, type); 1123 JS('void', '#.type = #', this._jsObject, type);
1148 } 1124 }
1149 1125
1150 /// The suggested file name that will be presented to the user as the default 1126 /// The suggested file name that will be presented to the user as the default
1151 /// name to read or write. This is optional. 1127 /// name to read or write. This is optional.
1152 String get suggestedName => JS('String', '#.suggestedName', this._jsObject); 1128 String get suggestedName => JS('String', '#.suggestedName', this._jsObject);
1153 1129
1154 void set suggestedName(String suggestedName) { 1130 void set suggestedName(String suggestedName) {
1155 JS('void', '#.suggestedName = #', this._jsObject, suggestedName); 1131 JS('void', '#.suggestedName = #', this._jsObject, suggestedName);
1156 } 1132 }
1157 1133
1158 /// The optional list of accept options for this file opener. Each option will 1134 /// The optional list of accept options for this file opener. Each option will
1159 /// be presented as a unique group to the end-user. 1135 /// be presented as a unique group to the end-user.
1160 List<FilesystemAcceptOption> get accepts { 1136 List<FilesystemAcceptOption> get accepts {
1161 List<FilesystemAcceptOption> __proxy_accepts = new List<FilesystemAcceptOpti on>(); 1137 List<FilesystemAcceptOption> __proxy_accepts =
1138 new List<FilesystemAcceptOption>();
1162 int count = JS('int', '#.accepts.length', this._jsObject); 1139 int count = JS('int', '#.accepts.length', this._jsObject);
1163 for (int i = 0; i < count; i++) { 1140 for (int i = 0; i < count; i++) {
1164 var item = JS('', '#.accepts[#]', this._jsObject, i); 1141 var item = JS('', '#.accepts[#]', this._jsObject, i);
1165 __proxy_accepts.add(new FilesystemAcceptOption._proxy(item)); 1142 __proxy_accepts.add(new FilesystemAcceptOption._proxy(item));
1166 } 1143 }
1167 return __proxy_accepts; 1144 return __proxy_accepts;
1168 } 1145 }
1169 1146
1170 void set accepts(List<FilesystemAcceptOption> accepts) { 1147 void set accepts(List<FilesystemAcceptOption> accepts) {
1171 JS('void', '#.accepts = #', this._jsObject, convertArgument(accepts)); 1148 JS('void', '#.accepts = #', this._jsObject, convertArgument(accepts));
1172 } 1149 }
1173 1150
1174 /// Whether to accept all file types, in addition to the options specified in 1151 /// Whether to accept all file types, in addition to the options specified in
1175 /// the accepts argument. The default is true. If the accepts field is unset o r 1152 /// the accepts argument. The default is true. If the accepts field is unset o r
1176 /// contains no valid entries, this will always be reset to true. 1153 /// contains no valid entries, this will always be reset to true.
1177 bool get acceptsAllTypes => JS('bool', '#.acceptsAllTypes', this._jsObject); 1154 bool get acceptsAllTypes => JS('bool', '#.acceptsAllTypes', this._jsObject);
1178 1155
1179 void set acceptsAllTypes(bool acceptsAllTypes) { 1156 void set acceptsAllTypes(bool acceptsAllTypes) {
1180 JS('void', '#.acceptsAllTypes = #', this._jsObject, acceptsAllTypes); 1157 JS('void', '#.acceptsAllTypes = #', this._jsObject, acceptsAllTypes);
1181 } 1158 }
1182
1183 } 1159 }
1184 1160
1185 /** 1161 /**
1186 * Functions 1162 * Functions
1187 */ 1163 */
1188 1164
1189 class API_file_system { 1165 class API_file_system {
1190 /* 1166 /*
1191 * API connection 1167 * API connection
1192 */ 1168 */
1193 Object _jsObject; 1169 Object _jsObject;
1194 1170
1195 /* 1171 /*
1196 * Functions 1172 * Functions
1197 */ 1173 */
1198 /// Get the display path of a FileEntry object. The display path is based on 1174 /// Get the display path of a FileEntry object. The display path is based on
1199 /// the full path of the file on the local file system, but may be made more 1175 /// the full path of the file on the local file system, but may be made more
1200 /// readable for display purposes. 1176 /// readable for display purposes.
1201 void getDisplayPath(FileEntry fileEntry, void callback(String displayPath)) => JS('void', '#.getDisplayPath(#, #)', this._jsObject, convertArgument(fileEntry) , convertDartClosureToJS(callback, 1)); 1177 void getDisplayPath(FileEntry fileEntry, void callback(String displayPath)) =>
1178 JS('void', '#.getDisplayPath(#, #)', this._jsObject,
1179 convertArgument(fileEntry), convertDartClosureToJS(callback, 1));
1202 1180
1203 /// Get a writable FileEntry from another FileEntry. This call will fail if th e 1181 /// Get a writable FileEntry from another FileEntry. This call will fail if th e
1204 /// application does not have the 'write' permission under 'fileSystem'. 1182 /// application does not have the 'write' permission under 'fileSystem'.
1205 void getWritableEntry(FileEntry fileEntry, void callback(FileEntry fileEntry)) { 1183 void getWritableEntry(
1184 FileEntry fileEntry, void callback(FileEntry fileEntry)) {
1206 void __proxy_callback(fileEntry) { 1185 void __proxy_callback(fileEntry) {
1207 if (callback != null) { 1186 if (callback != null) {
1208 callback(fileEntry); 1187 callback(fileEntry);
1209 } 1188 }
1210 } 1189 }
1211 JS('void', '#.getWritableEntry(#, #)', this._jsObject, convertArgument(fileE ntry), convertDartClosureToJS(__proxy_callback, 1)); 1190
1191 JS(
1192 'void',
1193 '#.getWritableEntry(#, #)',
1194 this._jsObject,
1195 convertArgument(fileEntry),
1196 convertDartClosureToJS(__proxy_callback, 1));
1212 } 1197 }
1213 1198
1214 /// Gets whether this FileEntry is writable or not. 1199 /// Gets whether this FileEntry is writable or not.
1215 void isWritableEntry(FileEntry fileEntry, void callback(bool isWritable)) => J S('void', '#.isWritableEntry(#, #)', this._jsObject, convertArgument(fileEntry), convertDartClosureToJS(callback, 1)); 1200 void isWritableEntry(FileEntry fileEntry, void callback(bool isWritable)) =>
1201 JS('void', '#.isWritableEntry(#, #)', this._jsObject,
1202 convertArgument(fileEntry), convertDartClosureToJS(callback, 1));
1216 1203
1217 /// Ask the user to choose a file. 1204 /// Ask the user to choose a file.
1218 void chooseEntry(void callback(FileEntry fileEntry), [FilesystemChooseEntryOpt ions options]) { 1205 void chooseEntry(void callback(FileEntry fileEntry),
1206 [FilesystemChooseEntryOptions options]) {
1219 void __proxy_callback(fileEntry) { 1207 void __proxy_callback(fileEntry) {
1220 if (callback != null) { 1208 if (callback != null) {
1221 callback(fileEntry); 1209 callback(fileEntry);
1222 } 1210 }
1223 } 1211 }
1224 JS('void', '#.chooseEntry(#, #)', this._jsObject, convertArgument(options), convertDartClosureToJS(__proxy_callback, 1)); 1212
1213 JS('void', '#.chooseEntry(#, #)', this._jsObject, convertArgument(options),
1214 convertDartClosureToJS(__proxy_callback, 1));
1225 } 1215 }
1226 1216
1227 /// Returns the file entry with the given id if it can be restored. This call 1217 /// Returns the file entry with the given id if it can be restored. This call
1228 /// will fail otherwise. 1218 /// will fail otherwise.
1229 void restoreEntry(String id, void callback(FileEntry fileEntry)) { 1219 void restoreEntry(String id, void callback(FileEntry fileEntry)) {
1230 void __proxy_callback(fileEntry) { 1220 void __proxy_callback(fileEntry) {
1231 if (callback != null) { 1221 if (callback != null) {
1232 callback(fileEntry); 1222 callback(fileEntry);
1233 } 1223 }
1234 } 1224 }
1235 JS('void', '#.restoreEntry(#, #)', this._jsObject, id, convertDartClosureToJ S(__proxy_callback, 1)); 1225
1226 JS('void', '#.restoreEntry(#, #)', this._jsObject, id,
1227 convertDartClosureToJS(__proxy_callback, 1));
1236 } 1228 }
1237 1229
1238 /// Returns whether a file entry for the given id can be restored, i.e. whethe r 1230 /// Returns whether a file entry for the given id can be restored, i.e. whethe r
1239 /// restoreEntry would succeed with this id now. 1231 /// restoreEntry would succeed with this id now.
1240 void isRestorable(String id, void callback(bool isRestorable)) => JS('void', ' #.isRestorable(#, #)', this._jsObject, id, convertDartClosureToJS(callback, 1)); 1232 void isRestorable(String id, void callback(bool isRestorable)) => JS(
1233 'void',
1234 '#.isRestorable(#, #)',
1235 this._jsObject,
1236 id,
1237 convertDartClosureToJS(callback, 1));
1241 1238
1242 /// Returns an id that can be passed to restoreEntry to regain access to a 1239 /// Returns an id that can be passed to restoreEntry to regain access to a
1243 /// given file entry. Only the 500 most recently used entries are retained, 1240 /// given file entry. Only the 500 most recently used entries are retained,
1244 /// where calls to retainEntry and restoreEntry count as use. If the app has 1241 /// where calls to retainEntry and restoreEntry count as use. If the app has
1245 /// the 'retainEntries' permission under 'fileSystem', entries are retained 1242 /// the 'retainEntries' permission under 'fileSystem', entries are retained
1246 /// indefinitely. Otherwise, entries are retained only while the app is runnin g 1243 /// indefinitely. Otherwise, entries are retained only while the app is runnin g
1247 /// and across restarts. 1244 /// and across restarts.
1248 String retainEntry(FileEntry fileEntry) => JS('String', '#.retainEntry(#)', th is._jsObject, convertArgument(fileEntry)); 1245 String retainEntry(FileEntry fileEntry) => JS(
1246 'String', '#.retainEntry(#)', this._jsObject, convertArgument(fileEntry));
1249 1247
1250 API_file_system(this._jsObject) { 1248 API_file_system(this._jsObject) {}
1251 }
1252 } 1249 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_chrome/dartium/chrome_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698