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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 #if defined(USE_AURA) | 84 #if defined(USE_AURA) |
85 // FormatType can be used in a set on some platforms. | 85 // FormatType can be used in a set on some platforms. |
86 bool operator<(const FormatType& other) const; | 86 bool operator<(const FormatType& other) const; |
87 #endif | 87 #endif |
88 | 88 |
89 #if defined(OS_WIN) | 89 #if defined(OS_WIN) |
90 const FORMATETC& ToFormatEtc() const { return data_; } | 90 const FORMATETC& ToFormatEtc() const { return data_; } |
91 #elif defined(USE_AURA) | 91 #elif defined(USE_AURA) |
92 const std::string& ToString() const { return data_; } | 92 const std::string& ToString() const { return data_; } |
93 #elif defined(OS_MACOSX) | 93 #elif defined(OS_MACOSX) |
| 94 NSString* ToNSString() const { return data_; } |
94 // Custom copy and assignment constructor to handle NSString. | 95 // Custom copy and assignment constructor to handle NSString. |
95 FormatType(const FormatType& other); | 96 FormatType(const FormatType& other); |
96 FormatType& operator=(const FormatType& other); | 97 FormatType& operator=(const FormatType& other); |
97 #endif | 98 #endif |
98 | 99 |
99 bool Equals(const FormatType& other) const; | 100 bool Equals(const FormatType& other) const; |
100 | 101 |
101 private: | 102 private: |
102 friend class Clipboard; | 103 friend class Clipboard; |
103 | 104 |
104 // Platform-specific glue used internally by the Clipboard class. Each | 105 // Platform-specific glue used internally by the Clipboard class. Each |
105 // plaform should define,at least one of each of the following: | 106 // plaform should define,at least one of each of the following: |
106 // 1. A constructor that wraps that native clipboard format descriptor. | 107 // 1. A constructor that wraps that native clipboard format descriptor. |
107 // 2. An accessor to retrieve the wrapped descriptor. | 108 // 2. An accessor to retrieve the wrapped descriptor. |
108 // 3. A data member to hold the wrapped descriptor. | 109 // 3. A data member to hold the wrapped descriptor. |
109 // | 110 // |
110 // Note that in some cases, the accessor for the wrapped descriptor may be | 111 // Note that in some cases, the accessor for the wrapped descriptor may be |
111 // public, as these format types can be used by drag and drop code as well. | 112 // public, as these format types can be used by drag and drop code as well. |
112 #if defined(OS_WIN) | 113 #if defined(OS_WIN) |
113 explicit FormatType(UINT native_format); | 114 explicit FormatType(UINT native_format); |
114 FormatType(UINT native_format, LONG index); | 115 FormatType(UINT native_format, LONG index); |
115 UINT ToUINT() const { return data_.cfFormat; } | 116 UINT ToUINT() const { return data_.cfFormat; } |
116 FORMATETC data_; | 117 FORMATETC data_; |
117 #elif defined(USE_AURA) | 118 #elif defined(USE_AURA) |
118 explicit FormatType(const std::string& native_format); | 119 explicit FormatType(const std::string& native_format); |
119 const std::string& data() const { return data_; } | 120 const std::string& data() const { return data_; } |
120 std::string data_; | 121 std::string data_; |
121 #elif defined(OS_MACOSX) | 122 #elif defined(OS_MACOSX) |
122 explicit FormatType(NSString* native_format); | 123 explicit FormatType(NSString* native_format); |
123 NSString* ToNSString() const { return data_; } | |
124 NSString* data_; | 124 NSString* data_; |
125 #elif defined(OS_ANDROID) | 125 #elif defined(OS_ANDROID) |
126 explicit FormatType(const std::string& native_format); | 126 explicit FormatType(const std::string& native_format); |
127 const std::string& data() const { return data_; } | 127 const std::string& data() const { return data_; } |
128 std::string data_; | 128 std::string data_; |
129 #else | 129 #else |
130 #error No FormatType definition. | 130 #error No FormatType definition. |
131 #endif | 131 #endif |
132 | 132 |
133 // Copyable and assignable, since this is essentially an opaque value type. | 133 // Copyable and assignable, since this is essentially an opaque value type. |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 class AuraX11Details; | 365 class AuraX11Details; |
366 scoped_ptr<AuraX11Details> aurax11_details_; | 366 scoped_ptr<AuraX11Details> aurax11_details_; |
367 #endif | 367 #endif |
368 | 368 |
369 DISALLOW_COPY_AND_ASSIGN(Clipboard); | 369 DISALLOW_COPY_AND_ASSIGN(Clipboard); |
370 }; | 370 }; |
371 | 371 |
372 } // namespace ui | 372 } // namespace ui |
373 | 373 |
374 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ | 374 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ |
OLD | NEW |