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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js

Issue 1921413002: [DevTools] Move inspect and copy to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 }, 232 },
233 233
234 /** 234 /**
235 * @param {!RuntimeAgent.RemoteObject} payload 235 * @param {!RuntimeAgent.RemoteObject} payload
236 * @param {!Object=} hints 236 * @param {!Object=} hints
237 */ 237 */
238 _inspectRequested: function(payload, hints) 238 _inspectRequested: function(payload, hints)
239 { 239 {
240 var object = this.createRemoteObject(payload); 240 var object = this.createRemoteObject(payload);
241 241
242 if (hints.copyToClipboard) {
243 this._copyRequested(object);
244 return;
245 }
246
242 if (object.isNode()) { 247 if (object.isNode()) {
243 WebInspector.Revealer.revealPromise(object).then(object.release.bind (object)); 248 WebInspector.Revealer.revealPromise(object).then(object.release.bind (object));
244 return; 249 return;
245 } 250 }
246 251
247 if (object.type === "function") { 252 if (object.type === "function") {
248 WebInspector.RemoteFunction.objectAsFunction(object).targetFunctionD etails().then(didGetDetails); 253 WebInspector.RemoteFunction.objectAsFunction(object).targetFunctionD etails().then(didGetDetails);
249 return; 254 return;
250 } 255 }
251 256
252 /** 257 /**
253 * @param {?WebInspector.DebuggerModel.FunctionDetails} response 258 * @param {?WebInspector.DebuggerModel.FunctionDetails} response
254 */ 259 */
255 function didGetDetails(response) 260 function didGetDetails(response)
256 { 261 {
257 object.release(); 262 object.release();
258 if (!response || !response.location) 263 if (!response || !response.location)
259 return; 264 return;
260 WebInspector.Revealer.reveal(response.location); 265 WebInspector.Revealer.reveal(response.location);
261 } 266 }
262
263 if (hints.copyToClipboard)
264 InspectorFrontendHost.copyText(object.value);
265 object.release(); 267 object.release();
266 }, 268 },
267 269
270 /**
271 * @param {!WebInspector.RemoteObject} object
272 */
273 _copyRequested: function(object)
274 {
275 if (!object.objectId) {
276 InspectorFrontendHost.copyText(object.value);
277 return;
278 }
279 object.callFunctionJSON(toStringForClipboard, [ { value : object.subtype } ], InspectorFrontendHost.copyText.bind(InspectorFrontendHost));
280
281 /**
282 * @param {string} subtype
283 * @this {Object}
284 * @suppressReceiverCheck
285 */
286 function toStringForClipboard(subtype)
287 {
288 if (subtype === "node")
dgozman 2016/04/27 00:25:50 Can we use object.isNode()?
kozy 2016/04/27 01:22:00 This method is called on object in page not Remote
289 return this.outerHTML;
290 if (subtype && typeof this === "undefined")
291 return subtype + "";
292 try {
293 return JSON.stringify(this, null, " ");
294 } catch (e) {
295 return "" + this;
296 }
297 }
298 },
299
268 __proto__: WebInspector.SDKModel.prototype 300 __proto__: WebInspector.SDKModel.prototype
269 } 301 }
270 302
271 /** 303 /**
272 * @constructor 304 * @constructor
273 * @implements {RuntimeAgent.Dispatcher} 305 * @implements {RuntimeAgent.Dispatcher}
274 * @param {!WebInspector.RuntimeModel} runtimeModel 306 * @param {!WebInspector.RuntimeModel} runtimeModel
275 */ 307 */
276 WebInspector.RuntimeDispatcher = function(runtimeModel) 308 WebInspector.RuntimeDispatcher = function(runtimeModel)
277 { 309 {
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 /** 813 /**
782 * @param {string} listenerType 814 * @param {string} listenerType
783 */ 815 */
784 setListenerType: function(listenerType) 816 setListenerType: function(listenerType)
785 { 817 {
786 this._listenerType = listenerType; 818 this._listenerType = listenerType;
787 }, 819 },
788 820
789 __proto__: WebInspector.SDKObject.prototype 821 __proto__: WebInspector.SDKObject.prototype
790 } 822 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698