| 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 26 matching lines...) Expand all Loading... |
| 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"; | 46 const char kMimeTypePepperCustomData[] = "chromium/x-pepper-custom-data"; |
| 47 const char kMimeTypeWebCustomData[] = "chromium/x-web-custom-data"; | |
| 48 | 47 |
| 49 class ClipboardMap { | 48 class ClipboardMap { |
| 50 public: | 49 public: |
| 51 ClipboardMap(); | 50 ClipboardMap(); |
| 52 std::string Get(const std::string& format); | 51 std::string Get(const std::string& format); |
| 53 bool HasFormat(const std::string& format); | 52 bool HasFormat(const std::string& format); |
| 54 void Set(const std::string& format, const std::string& data); | 53 void Set(const std::string& format, const std::string& data); |
| 55 void CommitToAndroidClipboard(); | 54 void CommitToAndroidClipboard(); |
| 56 void Clear(); | 55 void Clear(); |
| 57 | 56 |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 const char* data_data, | 470 const char* data_data, |
| 472 size_t data_len) { | 471 size_t data_len) { |
| 473 g_map.Get().Set(format.ToString(), std::string(data_data, data_len)); | 472 g_map.Get().Set(format.ToString(), std::string(data_data, data_len)); |
| 474 } | 473 } |
| 475 | 474 |
| 476 bool RegisterClipboardAndroid(JNIEnv* env) { | 475 bool RegisterClipboardAndroid(JNIEnv* env) { |
| 477 return RegisterNativesImpl(env); | 476 return RegisterNativesImpl(env); |
| 478 } | 477 } |
| 479 | 478 |
| 480 } // namespace ui | 479 } // namespace ui |
| OLD | NEW |