OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // ----------------------------------------------------------------------------- | 5 // ----------------------------------------------------------------------------- |
6 // NOTE: If you change this file you need to touch renderer_resources.grd to | 6 // NOTE: If you change this file you need to touch renderer_resources.grd to |
7 // have your change take effect. | 7 // have your change take effect. |
8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
9 | 9 |
10 var chromium; | 10 var chromium; |
11 (function() { | 11 (function() { |
12 native function GetNextCallbackId(); | 12 native function GetNextCallbackId(); |
13 native function CreateWindow(); | 13 native function CreateWindow(); |
| 14 native function RemoveWindow(); |
14 native function GetWindows(); | 15 native function GetWindows(); |
15 native function GetTabsForWindow(); | 16 native function GetTabsForWindow(); |
16 native function GetTab(); | 17 native function GetTab(); |
17 native function CreateTab(); | 18 native function CreateTab(); |
18 native function UpdateTab(); | 19 native function UpdateTab(); |
19 native function MoveTab(); | 20 native function MoveTab(); |
20 native function RemoveTab(); | 21 native function RemoveTab(); |
21 native function GetBookmarks(); | 22 native function GetBookmarks(); |
22 native function GetBookmarkChildren(); | 23 native function GetBookmarkChildren(); |
23 native function GetBookmarkTree(); | 24 native function GetBookmarkTree(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 var callbackId = -1; | 84 var callbackId = -1; |
84 if (callback) { | 85 if (callback) { |
85 callbackId = GetNextCallbackId(); | 86 callbackId = GetNextCallbackId(); |
86 callbacks[callbackId] = callback; | 87 callbacks[callbackId] = callback; |
87 } | 88 } |
88 request(sargs, callbackId); | 89 request(sargs, callbackId); |
89 } | 90 } |
90 | 91 |
91 //---------------------------------------------------------------------------- | 92 //---------------------------------------------------------------------------- |
92 | 93 |
93 // Tabs | 94 // Windows |
94 chromium.tabs = {}; | 95 chromium.windows = {}; |
95 | 96 |
96 chromium.tabs.getWindows = function(windowQuery, callback) { | 97 chromium.windows.getWindows = function(windowQuery, callback) { |
97 validate(arguments, arguments.callee.params); | 98 validate(arguments, arguments.callee.params); |
98 sendRequest(GetWindows, windowQuery, callback); | 99 sendRequest(GetWindows, windowQuery, callback); |
99 }; | 100 }; |
100 | 101 |
101 chromium.tabs.getWindows.params = [ | 102 chromium.windows.getWindows.params = [ |
102 { | 103 { |
103 type: "object", | 104 type: "object", |
104 properties: { | 105 properties: { |
105 ids: { | 106 ids: { |
106 type: "array", | 107 type: "array", |
107 items: chromium.types.pInt, | 108 items: chromium.types.pInt, |
108 minItems: 1 | 109 minItems: 1 |
109 } | 110 } |
110 }, | 111 }, |
111 optional: true | 112 optional: true |
112 }, | 113 }, |
113 chromium.types.optFun | 114 chromium.types.optFun |
114 ]; | 115 ]; |
115 | 116 |
116 chromium.tabs.createWindow = function(createData, callback) { | 117 chromium.windows.createWindow = function(createData, callback) { |
117 validate(arguments, arguments.callee.params); | 118 validate(arguments, arguments.callee.params); |
118 sendRequest(CreateWindow, createData, callback); | 119 sendRequest(CreateWindow, createData, callback); |
119 }; | 120 }; |
120 chromium.tabs.createWindow.params = [ | 121 chromium.windows.createWindow.params = [ |
121 { | 122 { |
122 type: "object", | 123 type: "object", |
123 properties: { | 124 properties: { |
124 url: chromium.types.optStr, | 125 url: chromium.types.optStr, |
125 left: chromium.types.optInt, | 126 left: chromium.types.optInt, |
126 top: chromium.types.optInt, | 127 top: chromium.types.optInt, |
127 width: chromium.types.optPInt, | 128 width: chromium.types.optPInt, |
128 height: chromium.types.optPInt | 129 height: chromium.types.optPInt |
129 }, | 130 }, |
130 optional: true | 131 optional: true |
131 }, | 132 }, |
132 chromium.types.optFun | 133 chromium.types.optFun |
133 ]; | 134 ]; |
| 135 |
| 136 chromium.windows.removeWindow = function(windowId, callback) { |
| 137 validate(arguments, arguments.callee.params); |
| 138 sendRequest(RemoveWindow, windowId, callback); |
| 139 }; |
| 140 |
| 141 chromium.windows.removeWindow.params = [ |
| 142 chromium.types.pInt, |
| 143 chromium.types.optFun |
| 144 ]; |
| 145 |
| 146 // sends (windowId). |
| 147 // *WILL* be followed by tab-attached AND then tab-selection-changed. |
| 148 chromium.windows.onWindowCreated = new chromium.Event("window-created"); |
| 149 |
| 150 // sends (windowId). |
| 151 // *WILL* be preceded by sequences of tab-removed AND then |
| 152 // tab-selection-changed -- one for each tab that was contained in the window |
| 153 // that closed |
| 154 chromium.windows.onWindowRemoved = new chromium.Event("window-removed"); |
| 155 |
| 156 //---------------------------------------------------------------------------- |
| 157 |
| 158 // Tabs |
| 159 chromium.tabs = {}; |
134 | 160 |
135 // TODO(aa): This should eventually take an optional windowId param. | 161 // TODO(aa): This should eventually take an optional windowId param. |
136 chromium.tabs.getTabsForWindow = function(callback) { | 162 chromium.tabs.getTabsForWindow = function(callback) { |
137 validate(arguments, arguments.callee.params); | 163 validate(arguments, arguments.callee.params); |
138 sendRequest(GetTabsForWindow, null, callback); | 164 sendRequest(GetTabsForWindow, null, callback); |
139 }; | 165 }; |
140 | 166 |
141 chromium.tabs.getTabsForWindow.params = [ | 167 chromium.tabs.getTabsForWindow.params = [ |
142 chromium.types.optFun | 168 chromium.types.optFun |
143 ]; | 169 ]; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 new chromium.Event("bookmark-children-reordered"); | 399 new chromium.Event("bookmark-children-reordered"); |
374 | 400 |
375 | 401 |
376 //---------------------------------------------------------------------------- | 402 //---------------------------------------------------------------------------- |
377 | 403 |
378 // Self | 404 // Self |
379 chromium.self = {}; | 405 chromium.self = {}; |
380 chromium.self.onConnect = new chromium.Event("channel-connect"); | 406 chromium.self.onConnect = new chromium.Event("channel-connect"); |
381 })(); | 407 })(); |
382 | 408 |
OLD | NEW |