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

Side by Side Diff: chrome/renderer/resources/extensions/developer_private_custom_bindings.js

Issue 1018493002: [Extensions] Combine developerPrivate.inspect and developerPrivate.openDevTools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 developerPrivate API. 5 // Custom binding for the developerPrivate API.
6 6
7 var binding = require('binding').Binding.create('developerPrivate'); 7 var binding = require('binding').Binding.create('developerPrivate');
8 8
9 binding.registerCustomHook(function(bindingsAPI) { 9 binding.registerCustomHook(function(bindingsAPI) {
10 var apiFunctions = bindingsAPI.apiFunctions; 10 var apiFunctions = bindingsAPI.apiFunctions;
11 11
12 // Converts the argument of |functionName| from DirectoryEntry to URL. 12 // Converts the argument of |functionName| from DirectoryEntry to URL.
13 function bindFileSystemFunction(functionName) { 13 function bindFileSystemFunction(functionName) {
14 apiFunctions.setUpdateArgumentsPostValidate( 14 apiFunctions.setUpdateArgumentsPostValidate(
15 functionName, function(directoryEntry, callback) { 15 functionName, function(directoryEntry, callback) {
16 var fileSystemName = directoryEntry.filesystem.name; 16 var fileSystemName = directoryEntry.filesystem.name;
17 var relativePath = $String.slice(directoryEntry.fullPath, 1); 17 var relativePath = $String.slice(directoryEntry.fullPath, 1);
18 var url = directoryEntry.toURL(); 18 var url = directoryEntry.toURL();
19 return [fileSystemName, relativePath, url, callback]; 19 return [fileSystemName, relativePath, url, callback];
20 }); 20 });
21 } 21 }
22 22
23 bindFileSystemFunction('loadDirectory'); 23 bindFileSystemFunction('loadDirectory');
24 24
25 // developerPrivate.enable is the same as chrome.management.setEnabled. 25 // developerPrivate.enable is the same as chrome.management.setEnabled.
26 // TODO(devlin): Migrate callers off developerPrivate.enable. 26 // TODO(devlin): Migrate callers off developerPrivate.enable.
27 bindingsAPI.compiledApi.enable = chrome.management.setEnabled; 27 bindingsAPI.compiledApi.enable = chrome.management.setEnabled;
28
29 bindingsAPI.compiledApi.inspect = function(options, callback) {
not at google - send to devlin 2015/03/19 18:52:49 In this case you might be better off using setHand
Devlin 2015/03/19 20:27:33 Well, setHandleRequest looks like the right thing
30 var renderViewId = options.render_view_id;
31 if (typeof(renderViewId) == 'string') {
not at google - send to devlin 2015/03/19 18:52:49 typeof is a keyword not a function
Devlin 2015/03/19 20:27:33 Huh. Never knew (obviously works fine when called
32 renderViewId = parseInt(renderViewId);
33 if (isNaN(renderViewId))
34 throw new Error('Invalid value for render_view_id');
35 }
36 var renderProcessId = options.render_process_id;
37 if (typeof(renderProcessId) == 'string') {
38 renderProcessId = parseInt(renderProcessId);
39 if (isNaN(renderProcessId))
40 throw new Error('Invalid value for render_process_id');
41 }
42 chrome.developerPrivate.openDevTools({
43 extensionId: options.extension_id,
44 renderProcessId: renderProcessId,
45 renderViewId: renderViewId,
46 incognito: options.incognito
47 }, callback);
48 };
28 }); 49 });
29 50
30 exports.binding = binding.generate(); 51 exports.binding = binding.generate();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698