diff options
author | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-01 21:42:14 +0000 |
---|---|---|
committer | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-01 21:42:14 +0000 |
commit | 0c4c3884b89e0c5fb3adbbb0f3cdf092cda84a10 (patch) | |
tree | e942cc54be97b815ae60fdd7bbd65a2aa624d843 /base/scoped_clipboard_writer.h | |
parent | 2ef2712ec860306a843c0e18afbdc339da4917cd (diff) | |
download | chromium_src-0c4c3884b89e0c5fb3adbbb0f3cdf092cda84a10.zip chromium_src-0c4c3884b89e0c5fb3adbbb0f3cdf092cda84a10.tar.gz chromium_src-0c4c3884b89e0c5fb3adbbb0f3cdf092cda84a10.tar.bz2 |
The "Copy URL" link is always greyed out in the Chrome menu on popups [crbug.com/13488].
This turns out to be because it was never implemented.
Tested manually on Windows; I'll test on Linux before submitting.
BUG=13488
TEST=Tested manually on Windows and added a unit test for the new Clipboard function.
Review URL: http://codereview.chromium.org/210042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27772 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/scoped_clipboard_writer.h')
-rw-r--r-- | base/scoped_clipboard_writer.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/base/scoped_clipboard_writer.h b/base/scoped_clipboard_writer.h index ed63050..feea7cd 100644 --- a/base/scoped_clipboard_writer.h +++ b/base/scoped_clipboard_writer.h @@ -33,6 +33,10 @@ class ScopedClipboardWriter { // Converts |text| to UTF-8 and adds it to the clipboard. void WriteText(const string16& text); + // Converts the text of the URL to UTF-8 and adds it to the clipboard, then + // notifies the Clipboard that we just wrote a URL. + void WriteURL(const string16& text); + // Adds HTML to the clipboard. The url parameter is optional, but especially // useful if the HTML fragment contains relative links. void WriteHTML(const string16& markup, const std::string& source_url); @@ -60,11 +64,19 @@ class ScopedClipboardWriter { void WritePickledData(const Pickle& pickle, Clipboard::FormatType format); protected: + // Converts |text| to UTF-8 and adds it to the clipboard. If it's a URL, we + // also notify the clipboard of that fact. + void WriteTextOrURL(const string16& text, bool is_url); + // We accumulate the data passed to the various targets in the |objects_| // vector, and pass it to Clipboard::WriteObjects() during object destruction. Clipboard::ObjectMap objects_; Clipboard* clipboard_; + // We keep around the UTF-8 text of the URL in order to pass it to + // Clipboard::DidWriteURL(). + std::string url_text_; + private: DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriter); }; |