| 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/context_utils.h" | 7 #include "base/android/context_utils.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 // Various formats we support. | 38 // Various formats we support. |
| 39 const char kURLFormat[] = "url"; | 39 const char kURLFormat[] = "url"; |
| 40 const char kPlainTextFormat[] = "text"; | 40 const char kPlainTextFormat[] = "text"; |
| 41 const char kHTMLFormat[] = "html"; | 41 const char kHTMLFormat[] = "html"; |
| 42 const char kRTFFormat[] = "rtf"; | 42 const char kRTFFormat[] = "rtf"; |
| 43 const char kBitmapFormat[] = "bitmap"; | 43 const char kBitmapFormat[] = "bitmap"; |
| 44 const char kWebKitSmartPasteFormat[] = "webkit_smart"; | 44 const char kWebKitSmartPasteFormat[] = "webkit_smart"; |
| 45 const char kBookmarkFormat[] = "bookmark"; | 45 const char kBookmarkFormat[] = "bookmark"; |
| 46 const char kMimeTypePepperCustomData[] = "chromium/x-pepper-custom-data"; | |
| 47 const char kMimeTypeWebCustomData[] = "chromium/x-web-custom-data"; | |
| 48 | 46 |
| 49 class ClipboardMap { | 47 class ClipboardMap { |
| 50 public: | 48 public: |
| 51 ClipboardMap(); | 49 ClipboardMap(); |
| 52 std::string Get(const std::string& format); | 50 std::string Get(const std::string& format); |
| 53 bool HasFormat(const std::string& format); | 51 bool HasFormat(const std::string& format); |
| 54 void Set(const std::string& format, const std::string& data); | 52 void Set(const std::string& format, const std::string& data); |
| 55 void CommitToAndroidClipboard(); | 53 void CommitToAndroidClipboard(); |
| 56 void Clear(); | 54 void Clear(); |
| 57 | 55 |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 const char* data_data, | 469 const char* data_data, |
| 472 size_t data_len) { | 470 size_t data_len) { |
| 473 g_map.Get().Set(format.ToString(), std::string(data_data, data_len)); | 471 g_map.Get().Set(format.ToString(), std::string(data_data, data_len)); |
| 474 } | 472 } |
| 475 | 473 |
| 476 bool RegisterClipboardAndroid(JNIEnv* env) { | 474 bool RegisterClipboardAndroid(JNIEnv* env) { |
| 477 return RegisterNativesImpl(env); | 475 return RegisterNativesImpl(env); |
| 478 } | 476 } |
| 479 | 477 |
| 480 } // namespace ui | 478 } // namespace ui |
| OLD | NEW |