Chromium Code Reviews| Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
| =================================================================== |
| --- chrome/browser/ui/views/omnibox/omnibox_view_win.cc (revision 85569) |
| +++ chrome/browser/ui/views/omnibox/omnibox_view_win.cc (working copy) |
| @@ -958,8 +958,10 @@ |
| GURL url; |
| string16 title; |
| if (data.GetURLAndTitle(&url, &title)) { |
| - SetUserText(UTF8ToWide(url.spec())); |
| - model()->AcceptInput(CURRENT_TAB, true); |
| + string16 text(views::StripJavascriptSchemas(UTF8ToUTF16(url.spec()))); |
| + SetUserText(text); |
| + if (url.spec().length() == text.length()) |
| + model()->AcceptInput(CURRENT_TAB, true); |
| return CopyOrLinkDragOperation(event.source_operations()); |
| } |
| } else if (data.HasString()) { |
| @@ -2356,14 +2358,14 @@ |
| ui::Clipboard::BUFFER_STANDARD)) { |
| string16 text; |
| clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &text); |
| - |
| + string16 stripped_text(views::StripJavascriptSchemas(text)); |
|
Peter Kasting
2011/05/24 00:15:18
Nit: Just inline this into the next statement
Cris Neckar
2011/05/24 17:09:40
Done.
|
| // Note: Unlike in the find popup and textfield view, here we completely |
| // remove whitespace strings containing newlines. We assume users are |
| // most likely pasting in URLs that may have been split into multiple |
| // lines in terminals, email programs, etc., and so linebreaks indicate |
| // completely bogus whitespace that would just cause the input to be |
| // invalid. |
| - return CollapseWhitespace(text, true); |
| + return CollapseWhitespace(stripped_text, true); |
| } |
| // Try bookmark format. |
| @@ -2380,7 +2382,7 @@ |
| // pass resulting url string through GURL to normalize |
| GURL url(url_str); |
| if (url.is_valid()) |
| - return UTF8ToWide(url.spec()); |
| + return views::StripJavascriptSchemas(UTF8ToUTF16(url.spec())); |
| } |
| return string16(); |