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> |
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/shared_memory.h" | 15 #include "base/memory/shared_memory.h" |
15 #include "base/process.h" | 16 #include "base/process.h" |
16 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
17 #include "base/threading/platform_thread.h" | 18 #include "base/threading/platform_thread.h" |
18 #include "base/threading/thread_checker.h" | 19 #include "base/threading/thread_checker.h" |
19 #include "ui/base/ui_export.h" | 20 #include "ui/base/ui_export.h" |
20 | 21 |
21 #if defined(TOOLKIT_GTK) | 22 #if defined(TOOLKIT_GTK) |
22 #include <gdk/gdk.h> | 23 #include <gdk/gdk.h> |
23 #endif | 24 #endif |
24 | 25 |
25 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
26 #include <objidl.h> | 27 #include <objidl.h> |
27 #elif defined(OS_ANDROID) | 28 #elif defined(OS_ANDROID) |
28 #include <jni.h> | 29 #include <jni.h> |
29 | 30 |
30 #include "base/android/jni_android.h" | 31 #include "base/android/jni_android.h" |
31 #include "base/android/scoped_java_ref.h" | 32 #include "base/android/scoped_java_ref.h" |
32 #endif | 33 #endif |
33 | 34 |
34 #if defined(USE_AURA) && defined(USE_X11) | 35 #if defined(USE_AURA) && defined(USE_X11) |
35 #include "base/memory/scoped_ptr.h" | 36 #include "base/memory/scoped_ptr.h" |
36 #endif | 37 #endif |
37 | 38 |
38 namespace base { | 39 namespace base { |
39 class FilePath; | 40 class FilePath; |
40 } | 41 |
| 42 namespace win { |
| 43 class MessageWindow; |
| 44 } // namespace win |
| 45 } // namespace base |
41 | 46 |
42 namespace gfx { | 47 namespace gfx { |
43 class Size; | 48 class Size; |
44 } | 49 } |
45 | 50 |
46 class SkBitmap; | 51 class SkBitmap; |
47 | 52 |
48 #if defined(TOOLKIT_GTK) | 53 #if defined(TOOLKIT_GTK) |
49 typedef struct _GtkClipboard GtkClipboard; | 54 typedef struct _GtkClipboard GtkClipboard; |
50 #endif | 55 #endif |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 std::string* url); | 363 std::string* url); |
359 | 364 |
360 // Free a handle depending on its type (as intuited from format) | 365 // Free a handle depending on its type (as intuited from format) |
361 static void FreeData(unsigned int format, HANDLE data); | 366 static void FreeData(unsigned int format, HANDLE data); |
362 | 367 |
363 // Return the window that should be the clipboard owner, creating it | 368 // Return the window that should be the clipboard owner, creating it |
364 // if neccessary. Marked const for lazily initialization by const methods. | 369 // if neccessary. Marked const for lazily initialization by const methods. |
365 HWND GetClipboardWindow() const; | 370 HWND GetClipboardWindow() const; |
366 | 371 |
367 // Mark this as mutable so const methods can still do lazy initialization. | 372 // Mark this as mutable so const methods can still do lazy initialization. |
368 mutable HWND clipboard_owner_; | 373 mutable scoped_ptr<base::win::MessageWindow> clipboard_owner_; |
369 | 374 |
370 // True if we can create a window. | |
371 bool create_window_; | |
372 #elif defined(TOOLKIT_GTK) | 375 #elif defined(TOOLKIT_GTK) |
373 // The public API is via WriteObjects() which dispatches to multiple | 376 // The public API is via WriteObjects() which dispatches to multiple |
374 // Write*() calls, but on GTK we must write all the clipboard types | 377 // Write*() calls, but on GTK we must write all the clipboard types |
375 // in a single GTK call. To support this we store the current set | 378 // in a single GTK call. To support this we store the current set |
376 // of data we intend to put on the clipboard on clipboard_data_ as | 379 // of data we intend to put on the clipboard on clipboard_data_ as |
377 // WriteObjects is running, and then at the end call SetGtkClipboard | 380 // WriteObjects is running, and then at the end call SetGtkClipboard |
378 // which replaces whatever is on the system clipboard with the | 381 // which replaces whatever is on the system clipboard with the |
379 // contents of clipboard_data_. | 382 // contents of clipboard_data_. |
380 | 383 |
381 public: | 384 public: |
(...skipping 18 matching lines...) Expand all Loading... |
400 class AuraX11Details; | 403 class AuraX11Details; |
401 scoped_ptr<AuraX11Details> aurax11_details_; | 404 scoped_ptr<AuraX11Details> aurax11_details_; |
402 #endif | 405 #endif |
403 | 406 |
404 DISALLOW_COPY_AND_ASSIGN(Clipboard); | 407 DISALLOW_COPY_AND_ASSIGN(Clipboard); |
405 }; | 408 }; |
406 | 409 |
407 } // namespace ui | 410 } // namespace ui |
408 | 411 |
409 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 412 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
OLD | NEW |