| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 std::vector<base::string16>* types, | 308 std::vector<base::string16>* types, |
| 309 bool* contains_filenames) const { | 309 bool* contains_filenames) const { |
| 310 DCHECK(CalledOnValidThread()); | 310 DCHECK(CalledOnValidThread()); |
| 311 DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); | 311 DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); |
| 312 | 312 |
| 313 if (!types || !contains_filenames) { | 313 if (!types || !contains_filenames) { |
| 314 NOTREACHED(); | 314 NOTREACHED(); |
| 315 return; | 315 return; |
| 316 } | 316 } |
| 317 | 317 |
| 318 NOTIMPLEMENTED(); | 318 types->clear(); |
| 319 | 319 |
| 320 types->clear(); | 320 if (IsFormatAvailable(GetPlainTextFormatType(), type)) |
| 321 types->push_back(base::UTF8ToUTF16(kMimeTypeText)); |
| 322 if (IsFormatAvailable(GetHtmlFormatType(), type)) |
| 323 types->push_back(base::UTF8ToUTF16(kMimeTypeHTML)); |
| 324 |
| 321 *contains_filenames = false; | 325 *contains_filenames = false; |
| 322 } | 326 } |
| 323 | 327 |
| 324 void ClipboardAndroid::ReadText(ClipboardType type, | 328 void ClipboardAndroid::ReadText(ClipboardType type, |
| 325 base::string16* result) const { | 329 base::string16* result) const { |
| 326 DCHECK(CalledOnValidThread()); | 330 DCHECK(CalledOnValidThread()); |
| 327 DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); | 331 DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); |
| 328 std::string utf8; | 332 std::string utf8; |
| 329 ReadAsciiText(type, &utf8); | 333 ReadAsciiText(type, &utf8); |
| 330 *result = base::UTF8ToUTF16(utf8); | 334 *result = base::UTF8ToUTF16(utf8); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 const char* data_data, | 462 const char* data_data, |
| 459 size_t data_len) { | 463 size_t data_len) { |
| 460 g_map.Get().Set(format.ToString(), std::string(data_data, data_len)); | 464 g_map.Get().Set(format.ToString(), std::string(data_data, data_len)); |
| 461 } | 465 } |
| 462 | 466 |
| 463 bool RegisterClipboardAndroid(JNIEnv* env) { | 467 bool RegisterClipboardAndroid(JNIEnv* env) { |
| 464 return RegisterNativesImpl(env); | 468 return RegisterNativesImpl(env); |
| 465 } | 469 } |
| 466 | 470 |
| 467 } // namespace ui | 471 } // namespace ui |
| OLD | NEW |