summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 18:07:31 +0000
committerjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-26 18:07:31 +0000
commit8383c5cfa4a2e988f8ae0ba10b795e0a64757a84 (patch)
tree021b7ec2e1fa2348939e1e23a1f2aa70ccd35001 /chrome/browser/autocomplete
parent3993fc88c7015559f8aa9c78ca969b5de6d8783e (diff)
downloadchromium_src-8383c5cfa4a2e988f8ae0ba10b795e0a64757a84.zip
chromium_src-8383c5cfa4a2e988f8ae0ba10b795e0a64757a84.tar.gz
chromium_src-8383c5cfa4a2e988f8ae0ba10b795e0a64757a84.tar.bz2
Don't use URL-encoded strings when user's input is in progress or the text isn't
HTTP/HTTPs. It seems that Firefox is doing the same thing. BUG=16534 (http://crbug.com/16534) TEST=Visit any website and append double-quote (") for the URL and invoke "Select All" by Control-A, then copy the URL by Control-C. Paste the result into notepad and check if the double-quote is NOT encoded. TEST=Access file:///" and select whole Omnibox and copy the URL. Paste the text into notepad and check if the double-quote is NOT URL encoded. TEST=Put " in Omnibox and type enter key so that you will be navigated to http://www.google.co.jp/search?sourceid=chrome&ie=UTF-8&q=%22. Copy whole content in Omnibox and paste it into notepad. Then, check if the double-quote is URL-encoded (%22). Original Review: http://codereview.chromium.org/155495/show Patch by hamaji@chromium.org (he's on vacation and asked me to land) git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24472 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_win.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index 839e1b3..59d6a9e 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -1201,9 +1201,15 @@ void AutocompleteEditViewWin::OnCopy() {
// copy, which will screw up our calculation of the desired_tld.
GURL url;
if (model_->GetURLForText(text, &url)) {
- // We should write URL instead of text as text may contain non ASCII
- // characters and the text may change when it is pasted.
- scw.WriteText(UTF8ToWide(url.spec()));
+ // If the scheme is http or https and the user isn't editing,
+ // we should copy the true URL instead of the (unescaped) display
+ // string to avoid encoding and escaping issues when pasting this text
+ // elsewhere.
+ if ((url.SchemeIs("http") || url.SchemeIs("https")) &&
+ !model_->user_input_in_progress())
+ scw.WriteText(UTF8ToWide(url.spec()));
+ else
+ scw.WriteText(text);
scw.WriteHyperlink(text, url.spec());
return;
}