diff options
author | hamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-09 16:21:51 +0000 |
---|---|---|
committer | hamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-09 16:21:51 +0000 |
commit | a914df178a5f13444e35545b76d05143bbb2db62 (patch) | |
tree | 56d1be9d40e079b31e827abf54da330375729d32 /chrome/browser/autocomplete | |
parent | 850dc30e30f7166990835195f594556b1de3716b (diff) | |
download | chromium_src-a914df178a5f13444e35545b76d05143bbb2db62.zip chromium_src-a914df178a5f13444e35545b76d05143bbb2db62.tar.gz chromium_src-a914df178a5f13444e35545b76d05143bbb2db62.tar.bz2 |
Copy parsed URL into CF_UNICODETEXT when user select entire of Omnibox.
BUG=2820
BUG=8162
TEST=Visit http://www.google.com/search?ie=UTF-8&q=荳雁慍 and select entire text in Omnibox, then copy the text.
Paste the copied text into other applications such as notepad and check if the pasted text contains %E4%B8%8A%E5%9C%B0, not 荳雁慍.
Paste the copied text into Firefox's URL bar and type return. Check if you are navigated to the same website.
Paste the copied text into textareas in Chrome and check if the pasted text contains %E4%B8%8A%E5%9C%B0.
Paste the copied text into Gmail's rich text editing mode and check if the pasted text contains 荳雁慍.
Right click the link you pasted in Gmail and check if you see "Go to: http://www.google.com/...%E4%B8%8A%E5%9C%B0".
Paste the copied text into URL-aware softwares such as MS-word and check if the pasted text contains 荳雁慍.
Check if the link in MS-word is pointing to encoded URL (http://www.google.com/...%E4%B8%8A%E5%9C%B0).
TEST=Visit http://www.google.com/search?ie=UTF-8&q=荳雁慍 again and select "q=荳雁慍" in Omnibox, then copy the text.
Paste it into somewhere and check if you see "q=荳雁慍".
TEST=Copy "荳雁慍" from somewhere and paste it into Omnibox.
Copy from Omnibox and paste it into notepad. Then check if the pasted text is NOT encoded.
Review URL: http://codereview.chromium.org/119352
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20265 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_win.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index ed4237b..4c75e0c 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -1178,21 +1178,24 @@ void AutocompleteEditViewWin::OnCopy() { return; ScopedClipboardWriter scw(g_browser_process->clipboard()); - scw.WriteText(text); - // Check if the user is copying the whole address bar. If they are, we // assume they are trying to copy a URL and write this to the clipboard as a // hyperlink. - if (static_cast<int>(text.length()) < GetTextLength()) - return; - - // The entire control is selected. Let's see what the user typed. We can't - // use model_->CurrentTextIsURL() or model_->GetDataForURLExport() because - // right now the user is probably holding down control to cause the copy, - // which will screw up our calculation of the desired_tld. - GURL url; - if (model_->GetURLForText(text, &url)) - scw.WriteHyperlink(text, url.spec()); + if (static_cast<int>(text.length()) >= GetTextLength()) { + // The entire control is selected. Let's see what the user typed. We + // can't use model_->CurrentTextIsURL() or model_->GetDataForURLExport() + // because right now the user is probably holding down control to cause the + // 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())); + scw.WriteHyperlink(text, url.spec()); + return; + } + } + scw.WriteText(text); } void AutocompleteEditViewWin::OnCut() { |