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

Unified Diff: base/string_util.cc

Issue 6982011: Strip leading "javascript:" schemas from text pasted or dropped into the omnibox. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
Index: base/string_util.cc
===================================================================
--- base/string_util.cc (revision 84514)
+++ base/string_util.cc (working copy)
@@ -910,6 +910,17 @@
return result;
}
+bool StripJavascriptSchema(const string16& text, string16* out) {
+ const string16 kJsSchema(ASCIIToUTF16("javascript:"));
Avi (use Gerrit) 2011/05/10 23:41:06 Plus, when you move this out of base, like pkastin
Cris Neckar 2011/05/11 21:42:36 Done.
+ bool changed = false;
+ *out = text;
+ while (StartsWith(*out, kJsSchema, false)) {
+ changed = true;
+ TrimWhitespace(out->substr(kJsSchema.length()), TRIM_LEADING, out);
+ }
+ return changed;
+}
+
static bool IsWildcard(base_icu::UChar32 character) {
return character == '*' || character == '?';
}

Powered by Google App Engine
This is Rietveld 408576698