diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-03 04:25:37 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-03 04:25:37 +0000 |
commit | 90f399075f9082bf7031512d6579ec1196dc060a (patch) | |
tree | 8d47273615d98732a60d0e77a0787d1623204a4b /base/scoped_clipboard_writer.h | |
parent | f0f400cb2e0a3c545d723524e8bbaf136caacf81 (diff) | |
download | chromium_src-90f399075f9082bf7031512d6579ec1196dc060a.zip chromium_src-90f399075f9082bf7031512d6579ec1196dc060a.tar.gz chromium_src-90f399075f9082bf7031512d6579ec1196dc060a.tar.bz2 |
Move the clipboard stuff out of base and into app/clipboard. I renamed
clipboard_util to clipboard_util_win since it's Windows-only. This patch makes
test_shell depend on app as well. There should be no logic change.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/260003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27937 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/scoped_clipboard_writer.h')
-rw-r--r-- | base/scoped_clipboard_writer.h | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/base/scoped_clipboard_writer.h b/base/scoped_clipboard_writer.h deleted file mode 100644 index feea7cd..0000000 --- a/base/scoped_clipboard_writer.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file declares the ScopedClipboardWriter class, a wrapper around -// the Clipboard class which simplifies writing data to the system clipboard. -// Upon deletion the class atomically writes all data to |clipboard_|, -// avoiding any potential race condition with other processes that are also -// writing to the system clipboard. -#ifndef BASE_SCOPED_CLIPBOARD_WRITER_H_ -#define BASE_SCOPED_CLIPBOARD_WRITER_H_ - -#include <string> -#include <vector> - -#include "base/clipboard.h" -#include "base/file_path.h" -#include "base/string16.h" - -class Pickle; - -// This class is a wrapper for |Clipboard| that handles packing data -// into a Clipboard::ObjectMap. -// NB: You should probably NOT be using this class if you include -// webkit_glue.h. Use ScopedClipboardWriterGlue instead. -class ScopedClipboardWriter { - public: - // Create an instance that is a simple wrapper around clipboard. - ScopedClipboardWriter(Clipboard* clipboard); - - ~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); - - // Adds a bookmark to the clipboard. - void WriteBookmark(const string16& bookmark_title, - const std::string& url); - - // Adds an html hyperlink (<a href>) to the clipboard. |anchor_text| should - // be escaped prior to being passed in. - void WriteHyperlink(const std::string& anchor_text, const std::string& url); - - // Adds a file or group of files to the clipboard. - void WriteFile(const FilePath& file); - void WriteFiles(const std::vector<FilePath>& files); - - // Used by WebKit to determine whether WebKit wrote the clipboard last - void WriteWebSmartPaste(); - - // Adds a bitmap to the clipboard - // Pixel format is assumed to be 32-bit BI_RGB. - void WriteBitmapFromPixels(const void* pixels, const gfx::Size& size); - - // Adds arbitrary data to clipboard. - 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); -}; - -#endif // BASE_SCOPED_CLIPBOARD_WRITER_H_ |