summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-27 23:15:23 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-27 23:15:23 +0000
commit3277c385ff33e524a587eaf7c273ed88f134a80b (patch)
tree3b367acec2368c1bada02669131bfae56a44853a /chrome
parentb40b77fad2dba01ccb67cb79468009f06e5173a1 (diff)
downloadchromium_src-3277c385ff33e524a587eaf7c273ed88f134a80b.zip
chromium_src-3277c385ff33e524a587eaf7c273ed88f134a80b.tar.gz
chromium_src-3277c385ff33e524a587eaf7c273ed88f134a80b.tar.bz2
Changes mac to call into AutocompleteEditModel method for
determining text to copy to clipboard. BUG=41493 TEST=see bug Review URL: http://codereview.chromium.org/1765008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45747 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_mac.mm38
1 files changed, 15 insertions, 23 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index ad6e11b..98e7af6 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
@@ -767,31 +767,23 @@ void AutocompleteEditViewMac::OnCopy() {
if (selection.length == 0)
return;
- const std::wstring& text = GetText();
- const string16 text16 = WideToUTF16(text);
-
+ std::wstring text = base::SysNSStringToWide(
+ [[field_ stringValue] substringWithRange:selection]);
+
+ GURL url;
+ bool write_url = false;
+ model_->AdjustTextForCopy(selection.location, IsSelectAll(), &text, &url,
+ &write_url);
+ string16 text16 = WideToUTF16(text);
ScopedClipboardWriter scw(g_browser_process->clipboard());
- // If the entire contents are being copied and it looks like an URL,
- // copy as a hyperlink.
- if (IsSelectAll()) {
- GURL url;
- if (model_->GetURLForText(text, &url)) {
- if ((url.SchemeIs("http") || url.SchemeIs("https")) &&
- !model_->user_input_in_progress())
- scw.WriteText(UTF8ToUTF16(url.spec()));
- else
- scw.WriteText(text16);
- scw.WriteBookmark(text16, url.spec());
-
- // This line, cargo cult copied from the Windows and GTK
- // versions (perhaps), breaks paste of an URL into Powerpoint
- // 2008. http://crbug.com/41842
- // scw.WriteHyperlink(EscapeForHTML(WideToUTF8(text)), url.spec());
- return;
- }
+ scw.WriteText(text16);
+ if (write_url) {
+ scw.WriteBookmark(text16, url.spec());
+ // This line, cargo cult copied from the Windows and GTK
+ // versions (perhaps), breaks paste of an URL into Powerpoint
+ // 2008. http://crbug.com/41842
+ // scw.WriteHyperlink(EscapeForHTML(WideToUTF8(text)), url.spec());
}
-
- scw.WriteText(text16.substr(selection.location, selection.length));
}
void AutocompleteEditViewMac::OnPaste() {