summaryrefslogtreecommitdiffstats
path: root/ui/base/clipboard/clipboard.h
diff options
context:
space:
mode:
Diffstat (limited to 'ui/base/clipboard/clipboard.h')
-rw-r--r--ui/base/clipboard/clipboard.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/ui/base/clipboard/clipboard.h b/ui/base/clipboard/clipboard.h
index b98cfc4..18463da 100644
--- a/ui/base/clipboard/clipboard.h
+++ b/ui/base/clipboard/clipboard.h
@@ -15,6 +15,7 @@
#include "base/shared_memory.h"
#include "base/string16.h"
#include "base/threading/thread_checker.h"
+#include "base/threading/platform_thread.h"
#include "ui/base/ui_export.h"
#if defined(TOOLKIT_GTK)
@@ -46,6 +47,7 @@ class NSString;
#endif
namespace ui {
+class ClipboardTest;
class UI_EXPORT Clipboard : NON_EXPORTED_BASE(public base::ThreadChecker) {
public:
@@ -182,8 +184,22 @@ class UI_EXPORT Clipboard : NON_EXPORTED_BASE(public base::ThreadChecker) {
return static_cast<Buffer>(buffer);
}
- Clipboard();
- ~Clipboard();
+ // Sets the list of threads that are allowed to access the clipboard.
+ static void SetAllowedThreads(
+ const std::vector<base::PlatformThreadId>& allowed_threads);
+
+ // Returns the clipboard object for the current thread.
+ //
+ // Most implementations will have at most one clipboard which will live on
+ // the main UI thread, but Windows has tricky semantics where there have to
+ // be two clipboards: one that lives on the UI thread and one that lives on
+ // the IO thread.
+ static Clipboard* GetForCurrentThread();
+
+ // Destroys the clipboard for the current thread. Usually, this will clean up
+ // all clipboards, except on Windows. (Previous code leaks the IO thread
+ // clipboard, so it shouldn't be a problem.)
+ static void DestroyClipboardForCurrentThread();
// Write a bunch of objects to the system clipboard. Copies are made of the
// contents of |objects|. On Windows they are copied to the system clipboard.
@@ -284,6 +300,10 @@ class UI_EXPORT Clipboard : NON_EXPORTED_BASE(public base::ThreadChecker) {
private:
FRIEND_TEST_ALL_PREFIXES(ClipboardTest, SharedBitmapTest);
FRIEND_TEST_ALL_PREFIXES(ClipboardTest, EmptyHTMLTest);
+ friend class ClipboardTest;
+
+ Clipboard();
+ ~Clipboard();
void DispatchObject(ObjectType type, const ObjectMapParams& params);