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 #include "ui/base/clipboard/clipboard_android.h" | 5 #include "ui/base/clipboard/clipboard_android.h" |
6 | 6 |
7 #include "base/android/jni_string.h" | 7 #include "base/android/jni_string.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 std::string Clipboard::FormatType::Serialize() const { | 191 std::string Clipboard::FormatType::Serialize() const { |
192 return data_; | 192 return data_; |
193 } | 193 } |
194 | 194 |
195 // static | 195 // static |
196 Clipboard::FormatType Clipboard::FormatType::Deserialize( | 196 Clipboard::FormatType Clipboard::FormatType::Deserialize( |
197 const std::string& serialization) { | 197 const std::string& serialization) { |
198 return FormatType(serialization); | 198 return FormatType(serialization); |
199 } | 199 } |
200 | 200 |
| 201 bool Clipboard::FormatType::operator<(const FormatType& other) const { |
| 202 return data_ < other.data_; |
| 203 } |
| 204 |
201 bool Clipboard::FormatType::Equals(const FormatType& other) const { | 205 bool Clipboard::FormatType::Equals(const FormatType& other) const { |
202 return data_ == other.data_; | 206 return data_ == other.data_; |
203 } | 207 } |
204 | 208 |
205 // Various predefined FormatTypes. | 209 // Various predefined FormatTypes. |
206 // static | 210 // static |
207 Clipboard::FormatType Clipboard::GetFormatType( | 211 Clipboard::FormatType Clipboard::GetFormatType( |
208 const std::string& format_string) { | 212 const std::string& format_string) { |
209 return FormatType::Deserialize(format_string); | 213 return FormatType::Deserialize(format_string); |
210 } | 214 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 269 |
266 // ClipboardAndroid implementation. | 270 // ClipboardAndroid implementation. |
267 ClipboardAndroid::ClipboardAndroid() { | 271 ClipboardAndroid::ClipboardAndroid() { |
268 DCHECK(CalledOnValidThread()); | 272 DCHECK(CalledOnValidThread()); |
269 } | 273 } |
270 | 274 |
271 ClipboardAndroid::~ClipboardAndroid() { | 275 ClipboardAndroid::~ClipboardAndroid() { |
272 DCHECK(CalledOnValidThread()); | 276 DCHECK(CalledOnValidThread()); |
273 } | 277 } |
274 | 278 |
275 uint64 ClipboardAndroid::GetSequenceNumber(ClipboardType /* type */) { | 279 uint64 ClipboardAndroid::GetSequenceNumber(ClipboardType /* type */) const { |
276 DCHECK(CalledOnValidThread()); | 280 DCHECK(CalledOnValidThread()); |
277 // TODO: implement this. For now this interface will advertise | 281 // TODO: implement this. For now this interface will advertise |
278 // that the clipboard never changes. That's fine as long as we | 282 // that the clipboard never changes. That's fine as long as we |
279 // don't rely on this signal. | 283 // don't rely on this signal. |
280 return 0; | 284 return 0; |
281 } | 285 } |
282 | 286 |
283 bool ClipboardAndroid::IsFormatAvailable(const Clipboard::FormatType& format, | 287 bool ClipboardAndroid::IsFormatAvailable(const Clipboard::FormatType& format, |
284 ClipboardType type) const { | 288 ClipboardType type) const { |
285 DCHECK(CalledOnValidThread()); | 289 DCHECK(CalledOnValidThread()); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 const char* data_data, | 451 const char* data_data, |
448 size_t data_len) { | 452 size_t data_len) { |
449 g_map.Get().Set(format.ToString(), std::string(data_data, data_len)); | 453 g_map.Get().Set(format.ToString(), std::string(data_data, data_len)); |
450 } | 454 } |
451 | 455 |
452 bool RegisterClipboardAndroid(JNIEnv* env) { | 456 bool RegisterClipboardAndroid(JNIEnv* env) { |
453 return RegisterNativesImpl(env); | 457 return RegisterNativesImpl(env); |
454 } | 458 } |
455 | 459 |
456 } // namespace ui | 460 } // namespace ui |
OLD | NEW |