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

Side by Side Diff: ui/base/clipboard/clipboard.h

Issue 232773008: More removal of GTK code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_H_ 5 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_H_
6 #define UI_BASE_CLIPBOARD_CLIPBOARD_H_ 6 #define UI_BASE_CLIPBOARD_CLIPBOARD_H_
7 7
8 #include <map> 8 #include <map>
Lei Zhang 2014/04/11 21:07:04 You can remove map and vector.
Elliot Glaysher 2014/04/11 21:28:16 No I can't. They're used elsewhere.
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/shared_memory.h" 15 #include "base/memory/shared_memory.h"
16 #include "base/process/process.h" 16 #include "base/process/process.h"
17 #include "base/strings/string16.h" 17 #include "base/strings/string16.h"
18 #include "base/threading/platform_thread.h" 18 #include "base/threading/platform_thread.h"
19 #include "base/threading/thread_checker.h" 19 #include "base/threading/thread_checker.h"
20 #include "ui/base/clipboard/clipboard_types.h" 20 #include "ui/base/clipboard/clipboard_types.h"
21 #include "ui/base/ui_base_export.h" 21 #include "ui/base/ui_base_export.h"
22 22
23 #if defined(TOOLKIT_GTK)
24 #include <gdk/gdk.h>
25 #endif
26
27 #if defined(OS_WIN) 23 #if defined(OS_WIN)
28 #include <objidl.h> 24 #include <objidl.h>
29 #elif defined(OS_ANDROID) 25 #elif defined(OS_ANDROID)
30 #include <jni.h> 26 #include <jni.h>
31 27
32 #include "base/android/jni_android.h" 28 #include "base/android/jni_android.h"
33 #include "base/android/scoped_java_ref.h" 29 #include "base/android/scoped_java_ref.h"
34 #endif 30 #endif
35 31
36 #if defined(USE_AURA) && defined(USE_X11) 32 #if defined(USE_AURA) && defined(USE_X11)
(...skipping 12 matching lines...) Expand all
49 namespace content { 45 namespace content {
50 class ClipboardMessageFilter; 46 class ClipboardMessageFilter;
51 } 47 }
52 48
53 namespace gfx { 49 namespace gfx {
54 class Size; 50 class Size;
55 } 51 }
56 52
57 class SkBitmap; 53 class SkBitmap;
58 54
59 #if defined(TOOLKIT_GTK)
60 typedef struct _GtkClipboard GtkClipboard;
61 #endif
62
63 #ifdef __OBJC__ 55 #ifdef __OBJC__
64 @class NSString; 56 @class NSString;
65 #else 57 #else
66 class NSString; 58 class NSString;
67 #endif 59 #endif
68 60
69 namespace ui { 61 namespace ui {
70 class ClipboardTest; 62 class ClipboardTest;
71 class ScopedClipboardWriter; 63 class ScopedClipboardWriter;
72 64
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 UINT ToUINT() const { return data_.cfFormat; } 115 UINT ToUINT() const { return data_.cfFormat; }
124 FORMATETC data_; 116 FORMATETC data_;
125 #elif defined(USE_AURA) 117 #elif defined(USE_AURA)
126 explicit FormatType(const std::string& native_format); 118 explicit FormatType(const std::string& native_format);
127 const std::string& data() const { return data_; } 119 const std::string& data() const { return data_; }
128 std::string data_; 120 std::string data_;
129 #elif defined(OS_MACOSX) 121 #elif defined(OS_MACOSX)
130 explicit FormatType(NSString* native_format); 122 explicit FormatType(NSString* native_format);
131 NSString* ToNSString() const { return data_; } 123 NSString* ToNSString() const { return data_; }
132 NSString* data_; 124 NSString* data_;
133 #elif defined(TOOLKIT_GTK)
134 explicit FormatType(const std::string& native_format);
135 explicit FormatType(const GdkAtom& native_format);
136 const GdkAtom& ToGdkAtom() const { return data_; }
137 GdkAtom data_;
138 #elif defined(OS_ANDROID) 125 #elif defined(OS_ANDROID)
139 explicit FormatType(const std::string& native_format); 126 explicit FormatType(const std::string& native_format);
140 const std::string& data() const { return data_; } 127 const std::string& data() const { return data_; }
141 std::string data_; 128 std::string data_;
142 #else 129 #else
143 #error No FormatType definition. 130 #error No FormatType definition.
144 #endif 131 #endif
145 132
146 // Copyable and assignable, since this is essentially an opaque value type. 133 // Copyable and assignable, since this is essentially an opaque value type.
147 }; 134 };
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 // Free a handle depending on its type (as intuited from format) 351 // Free a handle depending on its type (as intuited from format)
365 static void FreeData(unsigned int format, HANDLE data); 352 static void FreeData(unsigned int format, HANDLE data);
366 353
367 // Return the window that should be the clipboard owner, creating it 354 // Return the window that should be the clipboard owner, creating it
368 // if neccessary. Marked const for lazily initialization by const methods. 355 // if neccessary. Marked const for lazily initialization by const methods.
369 HWND GetClipboardWindow() const; 356 HWND GetClipboardWindow() const;
370 357
371 // Mark this as mutable so const methods can still do lazy initialization. 358 // Mark this as mutable so const methods can still do lazy initialization.
372 mutable scoped_ptr<base::win::MessageWindow> clipboard_owner_; 359 mutable scoped_ptr<base::win::MessageWindow> clipboard_owner_;
373 360
374 #elif defined(TOOLKIT_GTK)
375 // The public API is via WriteObjects() which dispatches to multiple
376 // Write*() calls, but on GTK we must write all the clipboard types
377 // in a single GTK call. To support this we store the current set
378 // of data we intend to put on the clipboard on clipboard_data_ as
379 // WriteObjects is running, and then at the end call SetGtkClipboard
380 // which replaces whatever is on the system clipboard with the
381 // contents of clipboard_data_.
382
383 public:
384 typedef std::map<std::string, std::pair<char*, size_t> > TargetMap;
385
386 private:
387 // Write changes to gtk clipboard.
388 void SetGtkClipboard(ClipboardType type);
389 // Insert a mapping into clipboard_data_.
390 void InsertMapping(const char* key, char* data, size_t data_len);
391
392 // Find the gtk clipboard for the passed type enum.
393 GtkClipboard* LookupBackingClipboard(ClipboardType type) const;
394
395 TargetMap* clipboard_data_;
396 GtkClipboard* clipboard_;
397 GtkClipboard* primary_selection_;
398 #elif defined(USE_CLIPBOARD_AURAX11) 361 #elif defined(USE_CLIPBOARD_AURAX11)
399 private: 362 private:
400 // We keep our implementation details private because otherwise we bring in 363 // We keep our implementation details private because otherwise we bring in
401 // the X11 headers and break chrome compile. 364 // the X11 headers and break chrome compile.
402 class AuraX11Details; 365 class AuraX11Details;
403 scoped_ptr<AuraX11Details> aurax11_details_; 366 scoped_ptr<AuraX11Details> aurax11_details_;
404 #endif 367 #endif
405 368
406 DISALLOW_COPY_AND_ASSIGN(Clipboard); 369 DISALLOW_COPY_AND_ASSIGN(Clipboard);
407 }; 370 };
408 371
409 } // namespace ui 372 } // namespace ui
410 373
411 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ 374 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698