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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/main/FrontendWebSocketAPI.js

Issue 1564113003: DevTools: merge uisourcecode's url-alike members. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 * @constructor 6 * @constructor
7 * @implements {WebInspector.Linkifier.LinkHandler} 7 * @implements {WebInspector.Linkifier.LinkHandler}
8 */ 8 */
9 WebInspector.FrontendWebSocketAPI = function() 9 WebInspector.FrontendWebSocketAPI = function()
10 { 10 {
(...skipping 20 matching lines...) Expand all
31 /** 31 /**
32 * @override 32 * @override
33 * @param {string} url 33 * @param {string} url
34 * @param {number=} lineNumber 34 * @param {number=} lineNumber
35 * @return {boolean} 35 * @return {boolean}
36 */ 36 */
37 handleLink: function(url, lineNumber) 37 handleLink: function(url, lineNumber)
38 { 38 {
39 var uiSourceCode = WebInspector.networkMapping.uiSourceCodeForURLForAnyT arget(url); 39 var uiSourceCode = WebInspector.networkMapping.uiSourceCodeForURLForAnyT arget(url);
40 if (uiSourceCode) 40 if (uiSourceCode)
41 url = uiSourceCode.originURL(); 41 url = uiSourceCode.url();
42 if (url.startsWith("file://")) { 42 if (url.startsWith("file://")) {
43 var file = url.substring(7); 43 var file = url.substring(7);
44 this._issueFrontendAPINotification("Frontend.revealLocation", { file : file, line: lineNumber }); 44 this._issueFrontendAPINotification("Frontend.revealLocation", { file : file, line: lineNumber });
45 return true; 45 return true;
46 } 46 }
47 return false; 47 return false;
48 }, 48 },
49 49
50 /** 50 /**
51 * @param {!WebInspector.Event} event 51 * @param {!WebInspector.Event} event
(...skipping 10 matching lines...) Expand all
62 * @param {?Object} params 62 * @param {?Object} params
63 */ 63 */
64 _dispatchFrontendAPIMessage: function(id, method, params) 64 _dispatchFrontendAPIMessage: function(id, method, params)
65 { 65 {
66 this._dispatchingFrontendMessage = true; 66 this._dispatchingFrontendMessage = true;
67 switch (method) { 67 switch (method) {
68 case "Frontend.updateBuffer": 68 case "Frontend.updateBuffer":
69 var file = params["file"]; 69 var file = params["file"];
70 var buffer = params["buffer"]; 70 var buffer = params["buffer"];
71 var saved = params["saved"]; 71 var saved = params["saved"];
72 var uiSourceCode = WebInspector.workspace.filesystemUISourceCode("fi le://" + file); 72 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL("file:/ /" + file);
73 if (uiSourceCode) { 73 if (uiSourceCode) {
74 if (buffer !== uiSourceCode.workingCopy()) 74 if (buffer !== uiSourceCode.workingCopy())
75 uiSourceCode.setWorkingCopy(buffer); 75 uiSourceCode.setWorkingCopy(buffer);
76 if (saved) 76 if (saved)
77 uiSourceCode.checkContentUpdated(true); 77 uiSourceCode.checkContentUpdated(true);
78 } 78 }
79 break; 79 break;
80 default: 80 default:
81 WebInspector.console.log("Unhandled API message: " + method); 81 WebInspector.console.log("Unhandled API message: " + method);
82 } 82 }
83 this._issueResponse(id); 83 this._issueResponse(id);
84 this._dispatchingFrontendMessage = false; 84 this._dispatchingFrontendMessage = false;
85 }, 85 },
86 86
87 /** 87 /**
88 * @param {!WebInspector.Event} event 88 * @param {!WebInspector.Event} event
89 * @param {boolean=} saved 89 * @param {boolean=} saved
90 */ 90 */
91 _workingCopyChanged: function(event, saved) 91 _workingCopyChanged: function(event, saved)
92 { 92 {
93 if (this._dispatchingFrontendMessage) 93 if (this._dispatchingFrontendMessage)
94 return; 94 return;
95 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data ["uiSourceCode"]); 95 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data ["uiSourceCode"]);
96 var url = uiSourceCode.originURL(); 96 var url = uiSourceCode.url();
97 if (url.startsWith("file://")) 97 if (url.startsWith("file://"))
98 url = url.substring(7); 98 url = url.substring(7);
99 var params = { file: url, buffer: uiSourceCode.workingCopy() }; 99 var params = { file: url, buffer: uiSourceCode.workingCopy() };
100 if (saved) 100 if (saved)
101 params.saved = true; 101 params.saved = true;
102 this._issueFrontendAPINotification("Frontend.bufferUpdated", params); 102 this._issueFrontendAPINotification("Frontend.bufferUpdated", params);
103 }, 103 },
104 104
105 /** 105 /**
106 * @param {!WebInspector.Event} event 106 * @param {!WebInspector.Event} event
(...skipping 17 matching lines...) Expand all
124 124
125 /** 125 /**
126 * @param {string} method 126 * @param {string} method
127 * @param {?Object} params 127 * @param {?Object} params
128 */ 128 */
129 _issueFrontendAPINotification: function(method, params) 129 _issueFrontendAPINotification: function(method, params)
130 { 130 {
131 InspectorFrontendHost.sendFrontendAPINotification(JSON.stringify({ metho d: method, params: params })); 131 InspectorFrontendHost.sendFrontendAPINotification(JSON.stringify({ metho d: method, params: params }));
132 } 132 }
133 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698