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

Side by Side Diff: Source/devtools/front_end/common/TextUtils.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, 4 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return text === text.toUpperCase(); 141 return text === text.toUpperCase();
142 }, 142 },
143 143
144 /** 144 /**
145 * @param {string} text 145 * @param {string} text
146 * @return {boolean} 146 * @return {boolean}
147 */ 147 */
148 isLowerCase: function(text) 148 isLowerCase: function(text)
149 { 149 {
150 return text === text.toLowerCase(); 150 return text === text.toLowerCase();
151 },
152
153 _lastSectionBeforeQuery: function(text, delimiter)
154 {
155 var lastIndexOfDot = text.lastIndexOf(delimiter);
156 var extension = lastIndexOfDot !== -1 ? text.substr(lastIndexOfDot + 1) : "";
157 var indexOfQuestionMark = extension.indexOf("?");
158 if (indexOfQuestionMark !== -1)
159 extension = extension.substr(0, indexOfQuestionMark);
160 return extension;
161 },
162
163 /**
164 * @param {string} text
165 * @return {string}
166 */
167 extension: function(text)
168 {
169 return WebInspector.TextUtils._lastSectionBeforeQuery(text, ".");
170 },
171
172 /**
173 * @param {string} text
174 * @return {string}
175 */
176 fileName: function(text)
177 {
178 return WebInspector.TextUtils._lastSectionBeforeQuery(text, "/");
151 } 179 }
152 } 180 }
153 181
154 WebInspector.TextUtils._SpaceCharRegex = /\s/; 182 WebInspector.TextUtils._SpaceCharRegex = /\s/;
155 183
156 /** 184 /**
157 * @enum {string} 185 * @enum {string}
158 */ 186 */
159 WebInspector.TextUtils.Indent = { 187 WebInspector.TextUtils.Indent = {
160 TwoSpaces: " ", 188 TwoSpaces: " ",
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 */ 260 */
233 WebInspector.TokenizerFactory = function() { } 261 WebInspector.TokenizerFactory = function() { }
234 262
235 WebInspector.TokenizerFactory.prototype = { 263 WebInspector.TokenizerFactory.prototype = {
236 /** 264 /**
237 * @param {string} mimeType 265 * @param {string} mimeType
238 * @return {function(string, function(string, ?string, number, number))} 266 * @return {function(string, function(string, ?string, number, number))}
239 */ 267 */
240 createTokenizer: function(mimeType) { } 268 createTokenizer: function(mimeType) { }
241 } 269 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/common/ResourceType.js ('k') | Source/devtools/front_end/components/ExecutionContextSelector.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698