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

Side by Side Diff: tools/dom/src/chrome/app_window.dart

Issue 23654055: Move dart:chrome to dart:_chrome. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 // Generated from namespace: app.window
6
7 part of chrome;
8
9 /**
10 * Types
11 */
12
13 class AppWindowBounds extends ChromeObject {
14 /*
15 * Public constructor
16 */
17 AppWindowBounds({int left, int top, int width, int height}) {
18 if (left != null)
19 this.left = left;
20 if (top != null)
21 this.top = top;
22 if (width != null)
23 this.width = width;
24 if (height != null)
25 this.height = height;
26 }
27
28 /*
29 * Private constructor
30 */
31 AppWindowBounds._proxy(_jsObject) : super._proxy(_jsObject);
32
33 /*
34 * Public accessors
35 */
36 int get left => JS('int', '#.left', this._jsObject);
37
38 void set left(int left) {
39 JS('void', '#.left = #', this._jsObject, left);
40 }
41
42 int get top => JS('int', '#.top', this._jsObject);
43
44 void set top(int top) {
45 JS('void', '#.top = #', this._jsObject, top);
46 }
47
48 int get width => JS('int', '#.width', this._jsObject);
49
50 void set width(int width) {
51 JS('void', '#.width = #', this._jsObject, width);
52 }
53
54 int get height => JS('int', '#.height', this._jsObject);
55
56 void set height(int height) {
57 JS('void', '#.height = #', this._jsObject, height);
58 }
59
60 }
61
62 class AppWindowCreateWindowOptions extends ChromeObject {
63 /*
64 * Public constructor
65 */
66 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}) {
67 if (id != null)
68 this.id = id;
69 if (defaultWidth != null)
70 this.defaultWidth = defaultWidth;
71 if (defaultHeight != null)
72 this.defaultHeight = defaultHeight;
73 if (defaultLeft != null)
74 this.defaultLeft = defaultLeft;
75 if (defaultTop != null)
76 this.defaultTop = defaultTop;
77 if (width != null)
78 this.width = width;
79 if (height != null)
80 this.height = height;
81 if (left != null)
82 this.left = left;
83 if (top != null)
84 this.top = top;
85 if (minWidth != null)
86 this.minWidth = minWidth;
87 if (minHeight != null)
88 this.minHeight = minHeight;
89 if (maxWidth != null)
90 this.maxWidth = maxWidth;
91 if (maxHeight != null)
92 this.maxHeight = maxHeight;
93 if (type != null)
94 this.type = type;
95 if (frame != null)
96 this.frame = frame;
97 if (bounds != null)
98 this.bounds = bounds;
99 if (transparentBackground != null)
100 this.transparentBackground = transparentBackground;
101 if (state != null)
102 this.state = state;
103 if (hidden != null)
104 this.hidden = hidden;
105 if (resizable != null)
106 this.resizable = resizable;
107 if (singleton != null)
108 this.singleton = singleton;
109 }
110
111 /*
112 * Private constructor
113 */
114 AppWindowCreateWindowOptions._proxy(_jsObject) : super._proxy(_jsObject);
115
116 /*
117 * Public accessors
118 */
119 /// Id to identify the window. This will be used to remember the size and
120 /// position of the window and restore that geometry when a window with the
121 /// same id is later opened.
122 String get id => JS('String', '#.id', this._jsObject);
123
124 void set id(String id) {
125 JS('void', '#.id = #', this._jsObject, id);
126 }
127
128 /// Default width of the window. (Deprecated; regular bounds act like this
129 /// now.)
130 int get defaultWidth => JS('int', '#.defaultWidth', this._jsObject);
131
132 void set defaultWidth(int defaultWidth) {
133 JS('void', '#.defaultWidth = #', this._jsObject, defaultWidth);
134 }
135
136 /// Default height of the window. (Deprecated; regular bounds act like this
137 /// now.)
138 int get defaultHeight => JS('int', '#.defaultHeight', this._jsObject);
139
140 void set defaultHeight(int defaultHeight) {
141 JS('void', '#.defaultHeight = #', this._jsObject, defaultHeight);
142 }
143
144 /// Default X coordinate of the window. (Deprecated; regular bounds act like
145 /// this now.)
146 int get defaultLeft => JS('int', '#.defaultLeft', this._jsObject);
147
148 void set defaultLeft(int defaultLeft) {
149 JS('void', '#.defaultLeft = #', this._jsObject, defaultLeft);
150 }
151
152 /// Default Y coordinate of the window. (Deprecated; regular bounds act like
153 /// this now.)
154 int get defaultTop => JS('int', '#.defaultTop', this._jsObject);
155
156 void set defaultTop(int defaultTop) {
157 JS('void', '#.defaultTop = #', this._jsObject, defaultTop);
158 }
159
160 /// Width of the window. (Deprecated; use 'bounds'.)
161 int get width => JS('int', '#.width', this._jsObject);
162
163 void set width(int width) {
164 JS('void', '#.width = #', this._jsObject, width);
165 }
166
167 /// Height of the window. (Deprecated; use 'bounds'.)
168 int get height => JS('int', '#.height', this._jsObject);
169
170 void set height(int height) {
171 JS('void', '#.height = #', this._jsObject, height);
172 }
173
174 /// X coordinate of the window. (Deprecated; use 'bounds'.)
175 int get left => JS('int', '#.left', this._jsObject);
176
177 void set left(int left) {
178 JS('void', '#.left = #', this._jsObject, left);
179 }
180
181 /// Y coordinate of the window. (Deprecated; use 'bounds'.)
182 int get top => JS('int', '#.top', this._jsObject);
183
184 void set top(int top) {
185 JS('void', '#.top = #', this._jsObject, top);
186 }
187
188 /// Minimum width for the lifetime of the window.
189 int get minWidth => JS('int', '#.minWidth', this._jsObject);
190
191 void set minWidth(int minWidth) {
192 JS('void', '#.minWidth = #', this._jsObject, minWidth);
193 }
194
195 /// Minimum height for the lifetime of the window.
196 int get minHeight => JS('int', '#.minHeight', this._jsObject);
197
198 void set minHeight(int minHeight) {
199 JS('void', '#.minHeight = #', this._jsObject, minHeight);
200 }
201
202 /// Maximum width for the lifetime of the window.
203 int get maxWidth => JS('int', '#.maxWidth', this._jsObject);
204
205 void set maxWidth(int maxWidth) {
206 JS('void', '#.maxWidth = #', this._jsObject, maxWidth);
207 }
208
209 /// Maximum height for the lifetime of the window.
210 int get maxHeight => JS('int', '#.maxHeight', this._jsObject);
211
212 void set maxHeight(int maxHeight) {
213 JS('void', '#.maxHeight = #', this._jsObject, maxHeight);
214 }
215
216 /// Type of window to create.
217 String get type => JS('String', '#.type', this._jsObject);
218
219 void set type(String type) {
220 JS('void', '#.type = #', this._jsObject, type);
221 }
222
223 /// Frame type: 'none' or 'chrome' (defaults to 'chrome').
224 String get frame => JS('String', '#.frame', this._jsObject);
225
226 void set frame(String frame) {
227 JS('void', '#.frame = #', this._jsObject, frame);
228 }
229
230 /// Size and position of the content in the window (excluding the titlebar). I f
231 /// an id is also specified and a window with a matching id has been shown
232 /// before, the remembered bounds of the window will be used instead.
233 AppWindowBounds get bounds => new AppWindowBounds._proxy(JS('', '#.bounds', th is._jsObject));
234
235 void set bounds(AppWindowBounds bounds) {
236 JS('void', '#.bounds = #', this._jsObject, convertArgument(bounds));
237 }
238
239 /// Enable window background transparency. Only supported in ash. Requires
240 /// experimental API permission.
241 bool get transparentBackground => JS('bool', '#.transparentBackground', this._ jsObject);
242
243 void set transparentBackground(bool transparentBackground) {
244 JS('void', '#.transparentBackground = #', this._jsObject, transparentBackgro und);
245 }
246
247 /// The initial state of the window, allowing it to be created already
248 /// fullscreen, maximized, or minimized. Defaults to 'normal'.
249 String get state => JS('String', '#.state', this._jsObject);
250
251 void set state(String state) {
252 JS('void', '#.state = #', this._jsObject, state);
253 }
254
255 /// If true, the window will be created in a hidden state. Call show() on the
256 /// window to show it once it has been created. Defaults to false.
257 bool get hidden => JS('bool', '#.hidden', this._jsObject);
258
259 void set hidden(bool hidden) {
260 JS('void', '#.hidden = #', this._jsObject, hidden);
261 }
262
263 /// If true, the window will be resizable by the user. Defaults to true.
264 bool get resizable => JS('bool', '#.resizable', this._jsObject);
265
266 void set resizable(bool resizable) {
267 JS('void', '#.resizable = #', this._jsObject, resizable);
268 }
269
270 /// By default if you specify an id for the window, the window will only be
271 /// created if another window with the same id doesn't already exist. If a
272 /// window with the same id already exists that window is activated instead. I f
273 /// you do want to create multiple windows with the same id, you can set this
274 /// property to false.
275 bool get singleton => JS('bool', '#.singleton', this._jsObject);
276
277 void set singleton(bool singleton) {
278 JS('void', '#.singleton = #', this._jsObject, singleton);
279 }
280
281 }
282
283 class AppWindowAppWindow extends ChromeObject {
284 /*
285 * Private constructor
286 */
287 AppWindowAppWindow._proxy(_jsObject) : super._proxy(_jsObject);
288
289 /*
290 * Public accessors
291 */
292 /// The JavaScript 'window' object for the created child.
293 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
294 // for details. All rights reserved. Use of this source code is governed by a
295 // BSD-style license that can be found in the LICENSE file.
296
297 // TODO(sashab, sra): Detect whether this is the current window, or an
298 // external one, and return an appropriately-typed object
299 WindowBase get contentWindow =>
300 JS("Window", "#.contentWindow", this._jsObject);
301
302 /*
303 * Methods
304 */
305 /// Focus the window.
306 void focus() => JS('void', '#.focus()', this._jsObject);
307
308 /// Fullscreens the window.
309 void fullscreen() => JS('void', '#.fullscreen()', this._jsObject);
310
311 /// Is the window fullscreen?
312 bool isFullscreen() => JS('bool', '#.isFullscreen()', this._jsObject);
313
314 /// Minimize the window.
315 void minimize() => JS('void', '#.minimize()', this._jsObject);
316
317 /// Is the window minimized?
318 bool isMinimized() => JS('bool', '#.isMinimized()', this._jsObject);
319
320 /// Maximize the window.
321 void maximize() => JS('void', '#.maximize()', this._jsObject);
322
323 /// Is the window maximized?
324 bool isMaximized() => JS('bool', '#.isMaximized()', this._jsObject);
325
326 /// Restore the window, exiting a maximized, minimized, or fullscreen state.
327 void restore() => JS('void', '#.restore()', this._jsObject);
328
329 /// Move the window to the position (|left|, |top|).
330 void moveTo(int left, int top) => JS('void', '#.moveTo(#, #)', this._jsObject, left, top);
331
332 /// Resize the window to |width|x|height| pixels in size.
333 void resizeTo(int width, int height) => JS('void', '#.resizeTo(#, #)', this._j sObject, width, height);
334
335 /// Draw attention to the window.
336 void drawAttention() => JS('void', '#.drawAttention()', this._jsObject);
337
338 /// Clear attention to the window.
339 void clearAttention() => JS('void', '#.clearAttention()', this._jsObject);
340
341 /// Close the window.
342 void close() => JS('void', '#.close()', this._jsObject);
343
344 /// Show the window. Does nothing if the window is already visible.
345 void show() => JS('void', '#.show()', this._jsObject);
346
347 /// Hide the window. Does nothing if the window is already hidden.
348 void hide() => JS('void', '#.hide()', this._jsObject);
349
350 /// Get the window's bounds as a $ref:Bounds object.
351 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
352 // for details. All rights reserved. Use of this source code is governed by a
353 // BSD-style license that can be found in the LICENSE file.
354
355 // TODO(sashab, kalman): Fix IDL parser to read function return values
356 // correctly. Currently, it just reads void for all functions.
357 AppWindowBounds getBounds() =>
358 new AppWindowBounds._proxy(JS('void', '#.getBounds()', this._jsObject));
359
360 /// Set the window's bounds.
361 void setBounds(AppWindowBounds bounds) => JS('void', '#.setBounds(#)', this._j sObject, convertArgument(bounds));
362
363 /// Set the app icon for the window (experimental). Currently this is only
364 /// being implemented on Ash. TODO(stevenjb): Investigate implementing this on
365 /// Windows and OSX.
366 void setIcon(String icon_url) => JS('void', '#.setIcon(#)', this._jsObject, ic on_url);
367
368 }
369
370 /**
371 * Events
372 */
373
374 /// Fired when the window is resized.
375 class Event_app_window_onBoundsChanged extends Event {
376 void addListener(void callback()) => super.addListener(callback);
377
378 void removeListener(void callback()) => super.removeListener(callback);
379
380 bool hasListener(void callback()) => super.hasListener(callback);
381
382 Event_app_window_onBoundsChanged(jsObject) : super._(jsObject, 0);
383 }
384
385 /// Fired when the window is closed.
386 class Event_app_window_onClosed extends Event {
387 void addListener(void callback()) => super.addListener(callback);
388
389 void removeListener(void callback()) => super.removeListener(callback);
390
391 bool hasListener(void callback()) => super.hasListener(callback);
392
393 Event_app_window_onClosed(jsObject) : super._(jsObject, 0);
394 }
395
396 /// Fired when the window is fullscreened.
397 class Event_app_window_onFullscreened extends Event {
398 void addListener(void callback()) => super.addListener(callback);
399
400 void removeListener(void callback()) => super.removeListener(callback);
401
402 bool hasListener(void callback()) => super.hasListener(callback);
403
404 Event_app_window_onFullscreened(jsObject) : super._(jsObject, 0);
405 }
406
407 /// Fired when the window is maximized.
408 class Event_app_window_onMaximized extends Event {
409 void addListener(void callback()) => super.addListener(callback);
410
411 void removeListener(void callback()) => super.removeListener(callback);
412
413 bool hasListener(void callback()) => super.hasListener(callback);
414
415 Event_app_window_onMaximized(jsObject) : super._(jsObject, 0);
416 }
417
418 /// Fired when the window is minimized.
419 class Event_app_window_onMinimized extends Event {
420 void addListener(void callback()) => super.addListener(callback);
421
422 void removeListener(void callback()) => super.removeListener(callback);
423
424 bool hasListener(void callback()) => super.hasListener(callback);
425
426 Event_app_window_onMinimized(jsObject) : super._(jsObject, 0);
427 }
428
429 /// Fired when the window is restored from being minimized or maximized.
430 class Event_app_window_onRestored extends Event {
431 void addListener(void callback()) => super.addListener(callback);
432
433 void removeListener(void callback()) => super.removeListener(callback);
434
435 bool hasListener(void callback()) => super.hasListener(callback);
436
437 Event_app_window_onRestored(jsObject) : super._(jsObject, 0);
438 }
439
440 /**
441 * Functions
442 */
443
444 class API_app_window {
445 /*
446 * API connection
447 */
448 Object _jsObject;
449
450 /*
451 * Events
452 */
453 Event_app_window_onBoundsChanged onBoundsChanged;
454 Event_app_window_onClosed onClosed;
455 Event_app_window_onFullscreened onFullscreened;
456 Event_app_window_onMaximized onMaximized;
457 Event_app_window_onMinimized onMinimized;
458 Event_app_window_onRestored onRestored;
459
460 /*
461 * Functions
462 */
463 /// The size and position of a window can be specified in a number of differen t
464 /// ways. The most simple option is not specifying anything at all, in which
465 /// case a default size and platform dependent position will be used.<br/><br/ >
466 /// Another option is to use the bounds property, which will put the window at
467 /// the specified coordinates with the specified size. If the window has a
468 /// frame, it's total size will be the size given plus the size of the frame;
469 /// that is, the size in bounds is the content size, not the window
470 /// size.<br/><br/> To automatically remember the positions of windows you can
471 /// give them ids. If a window has an id, This id is used to remember the size
472 /// and position of the window whenever it is moved or resized. This size and
473 /// position is then used instead of the specified bounds on subsequent openin g
474 /// of a window with the same id. If you need to open a window with an id at a
475 /// location other than the remembered default, you can create it hidden, move
476 /// it to the desired location, then show it.
477 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
478 // for details. All rights reserved. Use of this source code is governed by a
479 // BSD-style license that can be found in the LICENSE file.
480
481 // TODO(sashab): This override is no longer needed once prefixes are removed.
482 void create(String url,
483 [AppWindowCreateWindowOptions options,
484 void callback(AppWindowAppWindow created_window)]) {
485 void __proxy_callback(created_window) {
486 if (callback != null)
487 callback(new AppWindowAppWindow._proxy(created_window));
488 }
489 JS('void', '#.create(#, #, #)', this._jsObject, url, convertArgument(options ),
490 convertDartClosureToJS(__proxy_callback, 1));
491 }
492
493 /// Returns an $ref:AppWindow object for the current script context (ie
494 /// JavaScript 'window' object). This can also be called on a handle to a
495 /// script context for another page, for example:
496 /// otherWindow.chrome.app.window.current().
497 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
498 // for details. All rights reserved. Use of this source code is governed by a
499 // BSD-style license that can be found in the LICENSE file.
500
501 // TODO(sashab, kalman): Fix IDL parser to read function return values
502 // correctly. Currently, it just reads void for all functions.
503 AppWindowAppWindow current() =>
504 new AppWindowAppWindow._proxy(JS('void', '#.current()', this._jsObject));
505
506 void initializeAppWindow(Object state) => JS('void', '#.initializeAppWindow(#) ', this._jsObject, convertArgument(state));
507
508 API_app_window(this._jsObject) {
509 onBoundsChanged = new Event_app_window_onBoundsChanged(JS('', '#.onBoundsCha nged', this._jsObject));
510 onClosed = new Event_app_window_onClosed(JS('', '#.onClosed', this._jsObject ));
511 onFullscreened = new Event_app_window_onFullscreened(JS('', '#.onFullscreene d', this._jsObject));
512 onMaximized = new Event_app_window_onMaximized(JS('', '#.onMaximized', this. _jsObject));
513 onMinimized = new Event_app_window_onMinimized(JS('', '#.onMinimized', this. _jsObject));
514 onRestored = new Event_app_window_onRestored(JS('', '#.onRestored', this._js Object));
515 }
516 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698