From 3ee3ffd1d79a0c1544f3bfd70c7de7606df9482f Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Wed, 5 Nov 2008 01:34:30 +0000 Subject: Rewrote the clipboard API to be more concurrent. Added a helper class to make it more foolproof. Updated all clients and unittests. Mac port by jeremy@chromium.org Review URL: http://codereview.chromium.org/9154 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4719 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/autocomplete/autocomplete_edit.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'chrome/browser/autocomplete') diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc index 5974b81..fa60973 100644 --- a/chrome/browser/autocomplete/autocomplete_edit.cc +++ b/chrome/browser/autocomplete/autocomplete_edit.cc @@ -11,6 +11,7 @@ #include "base/gfx/skia_utils.h" #include "base/iat_patch.h" #include "base/ref_counted.h" +#include "base/scoped_clipboard_writer.h" #include "base/string_util.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/autocomplete/autocomplete_popup.h" @@ -1405,9 +1406,8 @@ void AutocompleteEditView::OnCopy() { if (text.empty()) return; - ClipboardService* clipboard = g_browser_process->clipboard_service(); - clipboard->Clear(); - clipboard->WriteText(text); + ScopedClipboardWriter scw(g_browser_process->clipboard_service()); + 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 @@ -1421,7 +1421,7 @@ void AutocompleteEditView::OnCopy() { // which will screw up our calculation of the desired_tld. GURL url; if (model_->GetURLForText(text, &url)) - clipboard->WriteHyperlink(text, url.spec()); + scw.WriteHyperlink(text, url.spec()); } void AutocompleteEditView::OnCut() { -- cgit v1.1