Index: chrome/browser/ui/omnibox/omnibox_view.h |
=================================================================== |
--- chrome/browser/ui/omnibox/omnibox_view.h (revision 85569) |
+++ chrome/browser/ui/omnibox/omnibox_view.h (working copy) |
@@ -15,8 +15,11 @@ |
#include <string> |
#include "base/string16.h" |
+#include "base/string_util.h" |
+#include "base/utf_string_conversions.h" |
#include "chrome/browser/autocomplete/autocomplete_match.h" |
#include "content/common/page_transition_types.h" |
+#include "content/common/url_constants.h" |
#include "ui/gfx/native_widget_types.h" |
#include "webkit/glue/window_open_disposition.h" |
@@ -187,4 +190,18 @@ |
virtual ~OmniboxView() {} |
}; |
+// Strips any leading javascript schemas from a string. |
+// Returns true if the output string differs from the input. |
+static inline bool StripJavascriptSchema(const string16& text, string16* out) { |
Peter Kasting
2011/05/20 22:04:14
Nit: Don't do this inline. It's not speed-critica
Cris Neckar
2011/05/24 00:10:06
Done.
|
+ const string16 kJsPrefix(UTF8ToUTF16(chrome::kJavaScriptScheme) + |
+ UTF8ToUTF16(":")); |
Peter Kasting
2011/05/20 22:04:14
Nit: I think both of these can be ASCIIToUTF16().
Cris Neckar
2011/05/24 00:10:06
Done.
|
+ bool changed = false; |
+ *out = text; |
Peter Kasting
2011/05/20 22:04:14
Nit: Shorter:
for (*out = text; StartsWith(*out
Cris Neckar
2011/05/24 00:10:06
Done.
|
+ while (StartsWith(*out, kJsPrefix, false)) { |
+ changed = true; |
+ TrimWhitespace(out->substr(kJsPrefix.length()), TRIM_LEADING, out); |
+ } |
+ return changed; |
+} |
+ |
#endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ |