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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.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
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(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,13 @@
ui::Clipboard::BUFFER_STANDARD)) {
string16 text;
clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &text);
-
// 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(StripJavascriptSchemas(text), true);
}
// Try bookmark format.
@@ -2380,7 +2381,7 @@
// pass resulting url string through GURL to normalize
GURL url(url_str);
if (url.is_valid())
- return UTF8ToWide(url.spec());
+ return StripJavascriptSchemas(UTF8ToUTF16(url.spec()));
}
return string16();
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698