| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Window management API for Ash/Chrome OS. |
| 6 |
| 7 namespace experimental.wm { |
| 8 enum WindowType { |
| 9 modal, |
| 10 normal, |
| 11 panel |
| 12 }; |
| 13 |
| 14 enum WindowListOrder { |
| 15 creation, |
| 16 activity |
| 17 }; |
| 18 |
| 19 enum WindowState { |
| 20 normal, |
| 21 minimized, |
| 22 maximized, |
| 23 fullscreen |
| 24 }; |
| 25 |
| 26 enum EventModifier { |
| 27 shift, |
| 28 control, |
| 29 alt |
| 30 }; |
| 31 |
| 32 enum Event { |
| 33 mousepress, |
| 34 mouserelease, |
| 35 mousemove, |
| 36 mousedrag, |
| 37 |
| 38 keypress, |
| 39 keyrelease, |
| 40 |
| 41 gesturetapdown, |
| 42 gesturetap, |
| 43 gesturescrollstart, |
| 44 gesturescrollend, |
| 45 gesturescrollupdate, |
| 46 gesturefling, |
| 47 gesturepinchstart, |
| 48 gesturepinchend, |
| 49 gesturepinchupdate |
| 50 }; |
| 51 |
| 52 // The position and size of windows in screen coordinates. |
| 53 dictionary Bounds { |
| 54 long x; |
| 55 long y; |
| 56 long width; |
| 57 long height; |
| 58 }; |
| 59 |
| 60 dictionary AshWindow { |
| 61 // A unique identifier for the window during the lifetime of the session. |
| 62 long id; |
| 63 |
| 64 // Window type and state. |
| 65 WindowType type; |
| 66 WindowState state; |
| 67 |
| 68 // The user-visible title of the window. This can be empty. |
| 69 DOMString title; |
| 70 |
| 71 // The name of the window. This is an internal name, i.e. invisible to the |
| 72 // user, and usually represents the class of the window (e.g. all browser |
| 73 // windows will usually have the same name). |
| 74 DOMString name; |
| 75 |
| 76 Bounds bounds; |
| 77 |
| 78 // At most one window can be active at a time. |
| 79 boolean active; |
| 80 }; |
| 81 |
| 82 dictionary TransformDetails { |
| 83 double? scale; |
| 84 |
| 85 double? translateX; |
| 86 double? translateY; |
| 87 |
| 88 double? perspective; |
| 89 |
| 90 double? rotate; |
| 91 }; |
| 92 |
| 93 callback AllWindowsCallback = void (AshWindow[] windows); |
| 94 callback ScreenBoundsCallback = void (Bounds bounds); |
| 95 callback EventCallback = void (AshWindow window); |
| 96 |
| 97 interface Functions { |
| 98 // Closes the window. If the window has child windows, then those windows |
| 99 // are closed too. |
| 100 static void close(long window_id); |
| 101 |
| 102 // Changes the state of the window to minimized, maximized, fullscreen, or |
| 103 // restores the window to its original bounds. |
| 104 static void minimize(long window_id); |
| 105 static void maximize(long window_id); |
| 106 static void fullscreen(long window_id); |
| 107 static void restore(long window_id); |
| 108 |
| 109 // Changes the opacity, transform or bounds of the windows. The change can |
| 110 // optionally be animated over the predefined duration, or set immediately. |
| 111 static void opacity(long window_id, |
| 112 double opacity, |
| 113 optional long durationInMilliSeconds); |
| 114 |
| 115 static void transform(long window_id, |
| 116 TransformDetails transform, |
| 117 optional long durationInMilliSeconds); |
| 118 |
| 119 static void setWindowBounds(long window_id, |
| 120 Bounds bounds, |
| 121 optional long durationInMilliSeconds); |
| 122 |
| 123 // Gets a list of all the windows. The list is in MRU order of |order| is |
| 124 // set to 'activity', otherwise the list is sorted based on their creation |
| 125 // time. |
| 126 static void windows(optional WindowListOrder order, |
| 127 AllWindowsCallback callback); |
| 128 |
| 129 // Gets the size of the screen. Currently this will work predictably for a |
| 130 // single monitor. |
| 131 // TODO(sad): Make this multi-monitor aware. |
| 132 static void screenBounds(ScreenBoundsCallback callback); |
| 133 |
| 134 // Stack one window above another. |
| 135 static void stackWindowAbove(long above_window_id, |
| 136 long below_window_id); |
| 137 |
| 138 }; |
| 139 |
| 140 interface Events { |
| 141 // This is triggered immediately after a window is created, but before it is |
| 142 // displayed. |
| 143 static void onWindowCreated(AshWindow window); |
| 144 |
| 145 // This is triggered whenever the window is closed (i.e. by the user, by |
| 146 // the web-page, or by the WM app from the close API call). |
| 147 static void onWindowClosed(AshWindow window); |
| 148 |
| 149 // This is triggered when a window is hidden. |
| 150 static void onWindowHidden(AshWindow window); |
| 151 |
| 152 // This is triggered when a window is made visible. |
| 153 static void onWindowShown(AshWindow window); |
| 154 |
| 155 // This is triggered when a new window becomes active. |
| 156 static void onActiveWindowChanged(AshWindow window); |
| 157 }; |
| 158 }; |
| OLD | NEW |