OLD | NEW |
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> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
26 #include <objidl.h> | 26 #include <objidl.h> |
27 #elif defined(OS_ANDROID) | 27 #elif defined(OS_ANDROID) |
28 #include <jni.h> | 28 #include <jni.h> |
29 | 29 |
30 #include "base/android/jni_android.h" | 30 #include "base/android/jni_android.h" |
31 #include "base/android/scoped_java_ref.h" | 31 #include "base/android/scoped_java_ref.h" |
32 #endif | 32 #endif |
33 | 33 |
34 #if defined(USE_AURA) && defined(USE_X11) | 34 #if (defined(USE_AURA) && defined(USE_X11)) || defined(OS_WIN) |
35 #include "base/memory/scoped_ptr.h" | 35 #include "base/memory/scoped_ptr.h" |
36 #endif | 36 #endif |
37 | 37 |
38 namespace base { | 38 namespace base { |
39 class FilePath; | 39 class FilePath; |
40 } | 40 } |
41 | 41 |
42 namespace gfx { | 42 namespace gfx { |
43 class Size; | 43 class Size; |
44 } | 44 } |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 base::ProcessHandle process); | 308 base::ProcessHandle process); |
309 #if defined(OS_WIN) | 309 #if defined(OS_WIN) |
310 // Firefox text/html | 310 // Firefox text/html |
311 static const FormatType& GetTextHtmlFormatType(); | 311 static const FormatType& GetTextHtmlFormatType(); |
312 static const FormatType& GetCFHDropFormatType(); | 312 static const FormatType& GetCFHDropFormatType(); |
313 static const FormatType& GetFileDescriptorFormatType(); | 313 static const FormatType& GetFileDescriptorFormatType(); |
314 static const FormatType& GetFileContentZeroFormatType(); | 314 static const FormatType& GetFileContentZeroFormatType(); |
315 #endif | 315 #endif |
316 | 316 |
317 private: | 317 private: |
| 318 class ClipboardWindow; |
| 319 |
318 FRIEND_TEST_ALL_PREFIXES(ClipboardTest, SharedBitmapTest); | 320 FRIEND_TEST_ALL_PREFIXES(ClipboardTest, SharedBitmapTest); |
319 FRIEND_TEST_ALL_PREFIXES(ClipboardTest, EmptyHTMLTest); | 321 FRIEND_TEST_ALL_PREFIXES(ClipboardTest, EmptyHTMLTest); |
320 friend class ClipboardTest; | 322 friend class ClipboardTest; |
321 | 323 |
322 Clipboard(); | 324 Clipboard(); |
323 ~Clipboard(); | 325 ~Clipboard(); |
324 | 326 |
325 void DispatchObject(ObjectType type, const ObjectMapParams& params); | 327 void DispatchObject(ObjectType type, const ObjectMapParams& params); |
326 | 328 |
327 void WriteText(const char* text_data, size_t text_len); | 329 void WriteText(const char* text_data, size_t text_len); |
(...skipping 29 matching lines...) Expand all Loading... |
357 std::string* url); | 359 std::string* url); |
358 | 360 |
359 // Free a handle depending on its type (as intuited from format) | 361 // Free a handle depending on its type (as intuited from format) |
360 static void FreeData(unsigned int format, HANDLE data); | 362 static void FreeData(unsigned int format, HANDLE data); |
361 | 363 |
362 // Return the window that should be the clipboard owner, creating it | 364 // Return the window that should be the clipboard owner, creating it |
363 // if neccessary. Marked const for lazily initialization by const methods. | 365 // if neccessary. Marked const for lazily initialization by const methods. |
364 HWND GetClipboardWindow() const; | 366 HWND GetClipboardWindow() const; |
365 | 367 |
366 // Mark this as mutable so const methods can still do lazy initialization. | 368 // Mark this as mutable so const methods can still do lazy initialization. |
367 mutable HWND clipboard_owner_; | 369 mutable scoped_ptr<ClipboardWindow> clipboard_owner_; |
368 | 370 |
369 // True if we can create a window. | |
370 bool create_window_; | |
371 #elif defined(TOOLKIT_GTK) | 371 #elif defined(TOOLKIT_GTK) |
372 // The public API is via WriteObjects() which dispatches to multiple | 372 // The public API is via WriteObjects() which dispatches to multiple |
373 // Write*() calls, but on GTK we must write all the clipboard types | 373 // Write*() calls, but on GTK we must write all the clipboard types |
374 // in a single GTK call. To support this we store the current set | 374 // in a single GTK call. To support this we store the current set |
375 // of data we intend to put on the clipboard on clipboard_data_ as | 375 // of data we intend to put on the clipboard on clipboard_data_ as |
376 // WriteObjects is running, and then at the end call SetGtkClipboard | 376 // WriteObjects is running, and then at the end call SetGtkClipboard |
377 // which replaces whatever is on the system clipboard with the | 377 // which replaces whatever is on the system clipboard with the |
378 // contents of clipboard_data_. | 378 // contents of clipboard_data_. |
379 | 379 |
380 public: | 380 public: |
(...skipping 18 matching lines...) Expand all Loading... |
399 class AuraX11Details; | 399 class AuraX11Details; |
400 scoped_ptr<AuraX11Details> aurax11_details_; | 400 scoped_ptr<AuraX11Details> aurax11_details_; |
401 #endif | 401 #endif |
402 | 402 |
403 DISALLOW_COPY_AND_ASSIGN(Clipboard); | 403 DISALLOW_COPY_AND_ASSIGN(Clipboard); |
404 }; | 404 }; |
405 | 405 |
406 } // namespace ui | 406 } // namespace ui |
407 | 407 |
408 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 408 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
OLD | NEW |