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

Side by Side Diff: Source/devtools/front_end/components/ExecutionContextSelector.js

Issue 1264133002: Devtools: [WIP] Implement enhanced devtools extension language APIs Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Small cleanups - prefer URIs to contentURLs, revert protocol unifications, remove lambdas Created 5 years, 3 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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.TargetManager.Observer} 7 * @implements {WebInspector.TargetManager.Observer}
8 * @param {!WebInspector.TargetManager} targetManager 8 * @param {!WebInspector.TargetManager} targetManager
9 * @param {!WebInspector.Context} context 9 * @param {!WebInspector.Context} context
10 */ 10 */
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 } 142 }
143 this._contextIsGoingAway = true; 143 this._contextIsGoingAway = true;
144 this._context.setFlavor(WebInspector.ExecutionContext, newContext); 144 this._context.setFlavor(WebInspector.ExecutionContext, newContext);
145 this._contextIsGoingAway = false; 145 this._contextIsGoingAway = false;
146 } 146 }
147 } 147 }
148 148
149 /** 149 /**
150 * @param {!Element} proxyElement 150 * @param {!Element} proxyElement
151 * @param {string} text
152 * @param {number} cursorOffset
151 * @param {!Range} wordRange 153 * @param {!Range} wordRange
152 * @param {boolean} force 154 * @param {boolean} force
153 * @param {function(!Array.<string>, number=)} completionsReadyCallback 155 * @param {function(!Array.<string>, number=)} completionsReadyCallback
154 */ 156 */
155 WebInspector.ExecutionContextSelector.completionsForTextPromptInCurrentContext = function(proxyElement, wordRange, force, completionsReadyCallback) 157 WebInspector.ExecutionContextSelector.completionsForTextPromptInCurrentContext = function(proxyElement, text, cursorOffset, wordRange, force, completionsReadyCa llback)
156 { 158 {
157 var executionContext = WebInspector.context.flavor(WebInspector.ExecutionCon text); 159 var executionContext = WebInspector.context.flavor(WebInspector.ExecutionCon text);
158 if (!executionContext) { 160 if (!executionContext) {
159 completionsReadyCallback([]); 161 completionsReadyCallback([]);
160 return; 162 return;
161 } 163 }
162 164
163 // Pass less stop characters to rangeOfWord so the range will be a more comp lete expression. 165 // Pass less stop characters to rangeOfWord so the range will be a more comp lete expression.
164 var expressionRange = wordRange.startContainer.rangeOfWord(wordRange.startOf fset, " =:({;,!+-*/&|^<>", proxyElement, "backward"); 166 var expressionRange = wordRange.startContainer.rangeOfWord(wordRange.startOf fset, " =:({;,!+-*/&|^<>", proxyElement, "backward");
165 var expressionString = expressionRange.toString(); 167 var expressionString = expressionRange.toString();
166 168
167 // The "[" is also a stop character, except when it's the last character of the expression. 169 // The "[" is also a stop character, except when it's the last character of the expression.
168 var pos = expressionString.lastIndexOf("[", expressionString.length - 2); 170 var pos = expressionString.lastIndexOf("[", expressionString.length - 2);
169 if (pos !== -1) 171 if (pos !== -1)
170 expressionString = expressionString.substr(pos + 1); 172 expressionString = expressionString.substr(pos + 1);
171 173
172 var prefix = wordRange.toString(); 174 var prefix = wordRange.toString();
173 executionContext.completionsForExpression(expressionString, prefix, force, c ompletionsReadyCallback); 175 executionContext.completionsForExpression(expressionString, text, cursorOffs et, prefix, force, completionsReadyCallback);
174 } 176 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/common/TextUtils.js ('k') | Source/devtools/front_end/components/SearchData.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698