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

Unified Diff: chrome/browser/autocomplete/autocomplete_edit_view_mac.mm

Issue 1765008: Changes mac to call into AutocompleteEditModel method for (Closed)
Patch Set: Created 10 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm
index ad6e11bf3974c718241d8579c62849a67bac3022..98e7af625da3896254e6d47f10354977a4ce354f 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() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698