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

Side by Side Diff: extensions/renderer/resources/app_window_custom_bindings.js

Issue 2105033003: tabId support to chrome.extensions.getViews() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor followup to patch 5 Created 4 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 // Custom binding for the app_window API. 5 // Custom binding for the app_window API.
6 6
7 var appWindowNatives = requireNative('app_window_natives'); 7 var appWindowNatives = requireNative('app_window_natives');
8 var runtimeNatives = requireNative('runtime'); 8 var runtimeNatives = requireNative('runtime');
9 var Binding = require('binding').Binding; 9 var Binding = require('binding').Binding;
10 var Event = require('event_bindings').Event; 10 var Event = require('event_bindings').Event;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 apiFunctions.setHandleRequest('current', function() { 178 apiFunctions.setHandleRequest('current', function() {
179 if (!currentAppWindow) { 179 if (!currentAppWindow) {
180 console.error('The JavaScript context calling ' + 180 console.error('The JavaScript context calling ' +
181 'chrome.app.window.current() has no associated AppWindow.'); 181 'chrome.app.window.current() has no associated AppWindow.');
182 return null; 182 return null;
183 } 183 }
184 return currentAppWindow; 184 return currentAppWindow;
185 }); 185 });
186 186
187 apiFunctions.setHandleRequest('getAll', function() { 187 apiFunctions.setHandleRequest('getAll', function() {
188 var views = runtimeNatives.GetExtensionViews(-1, 'APP_WINDOW'); 188 var views = runtimeNatives.GetExtensionViews(-1, -1, 'APP_WINDOW');
189 return $Array.map(views, function(win) { 189 return $Array.map(views, function(win) {
190 return win.chrome.app.window.current(); 190 return win.chrome.app.window.current();
191 }); 191 });
192 }); 192 });
193 193
194 apiFunctions.setHandleRequest('get', function(id) { 194 apiFunctions.setHandleRequest('get', function(id) {
195 var windows = $Array.filter(chrome.app.window.getAll(), function(win) { 195 var windows = $Array.filter(chrome.app.window.getAll(), function(win) {
196 return win.id == id; 196 return win.id == id;
197 }); 197 });
198 return windows.length > 0 ? windows[0] : null; 198 return windows.length > 0 ? windows[0] : null;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 constraints[key] = 0; 401 constraints[key] = 0;
402 }); 402 });
403 403
404 currentWindowInternal.setSizeConstraints(boundsType, constraints); 404 currentWindowInternal.setSizeConstraints(boundsType, constraints);
405 } 405 }
406 406
407 exports.$set('binding', appWindow.generate()); 407 exports.$set('binding', appWindow.generate());
408 exports.$set('onAppWindowClosed', onAppWindowClosed); 408 exports.$set('onAppWindowClosed', onAppWindowClosed);
409 exports.$set('updateAppWindowProperties', updateAppWindowProperties); 409 exports.$set('updateAppWindowProperties', updateAppWindowProperties);
410 exports.$set('appWindowShownForTests', onAppWindowShownForTests); 410 exports.$set('appWindowShownForTests', onAppWindowShownForTests);
OLDNEW
« no previous file with comments | « extensions/renderer/extension_frame_helper.cc ('k') | extensions/renderer/resources/extension_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698