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

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
Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc
===================================================================
--- chrome/browser/ui/views/omnibox/omnibox_view_win.cc (revision 84514)
+++ chrome/browser/ui/views/omnibox/omnibox_view_win.cc (working copy)
@@ -958,8 +958,11 @@
GURL url;
string16 title;
if (data.GetURLAndTitle(&url, &title)) {
- SetUserText(UTF8ToWide(url.spec()));
- model()->AcceptInput(CURRENT_TAB, true);
+ string16 text(UTF8ToUTF16(url.spec()));
+ bool changed = StripJavascriptSchema(text, &text);
+ SetUserText(text);
+ if (!changed)
+ model()->AcceptInput(CURRENT_TAB, true);
return CopyOrLinkDragOperation(event.source_operations());
}
} else if (data.HasString()) {
@@ -1720,7 +1723,8 @@
void OmniboxViewWin::OnPaste() {
// Replace the selection if we have something to paste.
- const string16 text(GetClipboardText());
+ string16 text(GetClipboardText());
+ StripJavascriptSchema(text, &text);
Peter Kasting 2011/05/10 23:27:42 You should be doing this fixup in GetClipboardText
Cris Neckar 2011/05/11 21:42:36 Done.
if (!text.empty()) {
// Record this paste, so we can do different behavior.
model_->on_paste();

Powered by Google App Engine
This is Rietveld 408576698