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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 std::string Serialize() const; | 83 std::string Serialize() const; |
84 static FormatType Deserialize(const std::string& serialization); | 84 static FormatType Deserialize(const std::string& serialization); |
85 | 85 |
86 #if defined(OS_WIN) || defined(USE_AURA) | 86 #if defined(OS_WIN) || defined(USE_AURA) |
87 // FormatType can be used in a set on some platforms. | 87 // FormatType can be used in a set on some platforms. |
88 bool operator<(const FormatType& other) const; | 88 bool operator<(const FormatType& other) const; |
89 #endif | 89 #endif |
90 | 90 |
91 #if defined(OS_WIN) | 91 #if defined(OS_WIN) |
92 const FORMATETC& ToFormatEtc() const { return data_; } | 92 const FORMATETC& ToFormatEtc() const { return data_; } |
| 93 #elif defined(USE_AURA) |
| 94 const std::string& ToString() const { return data_; } |
93 #elif defined(OS_MACOSX) | 95 #elif defined(OS_MACOSX) |
94 // Custom copy and assignment constructor to handle NSString. | 96 // Custom copy and assignment constructor to handle NSString. |
95 FormatType(const FormatType& other); | 97 FormatType(const FormatType& other); |
96 FormatType& operator=(const FormatType& other); | 98 FormatType& operator=(const FormatType& other); |
97 #elif defined(USE_AURA) | |
98 const std::string& ToString() const { return data_; } | |
99 #endif | 99 #endif |
100 | 100 |
101 private: | 101 private: |
102 friend class Clipboard; | 102 friend class Clipboard; |
103 | 103 |
104 bool Equals(const FormatType& other) const; | 104 bool Equals(const FormatType& other) const; |
105 | 105 |
106 // Platform-specific glue used internally by the Clipboard class. Each | 106 // Platform-specific glue used internally by the Clipboard class. Each |
107 // plaform should define,at least one of each of the following: | 107 // plaform should define,at least one of each of the following: |
108 // 1. A constructor that wraps that native clipboard format descriptor. | 108 // 1. A constructor that wraps that native clipboard format descriptor. |
109 // 2. An accessor to retrieve the wrapped descriptor. | 109 // 2. An accessor to retrieve the wrapped descriptor. |
110 // 3. A data member to hold the wrapped descriptor. | 110 // 3. A data member to hold the wrapped descriptor. |
111 // | 111 // |
112 // Note that in some cases, the accessor for the wrapped descriptor may be | 112 // Note that in some cases, the accessor for the wrapped descriptor may be |
113 // public, as these format types can be used by drag and drop code as well. | 113 // public, as these format types can be used by drag and drop code as well. |
114 #if defined(OS_WIN) | 114 #if defined(OS_WIN) |
115 explicit FormatType(UINT native_format); | 115 explicit FormatType(UINT native_format); |
116 FormatType(UINT native_format, LONG index); | 116 FormatType(UINT native_format, LONG index); |
117 UINT ToUINT() const { return data_.cfFormat; } | 117 UINT ToUINT() const { return data_.cfFormat; } |
118 FORMATETC data_; | 118 FORMATETC data_; |
| 119 #elif defined(USE_AURA) |
| 120 explicit FormatType(const std::string& native_format); |
| 121 std::string data_; |
119 #elif defined(OS_MACOSX) | 122 #elif defined(OS_MACOSX) |
120 explicit FormatType(NSString* native_format); | 123 explicit FormatType(NSString* native_format); |
121 NSString* ToNSString() const { return data_; } | 124 NSString* ToNSString() const { return data_; } |
122 NSString* data_; | 125 NSString* data_; |
123 #elif defined(USE_AURA) | |
124 explicit FormatType(const std::string& native_format); | |
125 std::string data_; | |
126 #elif defined(TOOLKIT_GTK) | 126 #elif defined(TOOLKIT_GTK) |
127 explicit FormatType(const std::string& native_format); | 127 explicit FormatType(const std::string& native_format); |
128 explicit FormatType(const GdkAtom& native_format); | 128 explicit FormatType(const GdkAtom& native_format); |
129 const GdkAtom& ToGdkAtom() const { return data_; } | 129 const GdkAtom& ToGdkAtom() const { return data_; } |
130 GdkAtom data_; | 130 GdkAtom data_; |
131 #elif defined(OS_ANDROID) | 131 #elif defined(OS_ANDROID) |
132 explicit FormatType(const std::string& native_format); | 132 explicit FormatType(const std::string& native_format); |
133 const std::string& data() const { return data_; } | 133 const std::string& data() const { return data_; } |
134 std::string data_; | 134 std::string data_; |
135 #else | 135 #else |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 class AuraX11Details; | 391 class AuraX11Details; |
392 scoped_ptr<AuraX11Details> aurax11_details_; | 392 scoped_ptr<AuraX11Details> aurax11_details_; |
393 #endif | 393 #endif |
394 | 394 |
395 DISALLOW_COPY_AND_ASSIGN(Clipboard); | 395 DISALLOW_COPY_AND_ASSIGN(Clipboard); |
396 }; | 396 }; |
397 | 397 |
398 } // namespace ui | 398 } // namespace ui |
399 | 399 |
400 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 400 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
OLD | NEW |