OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/ppb_flash_clipboard_impl.h" | 5 #include "webkit/plugins/ppapi/ppb_flash_clipboard_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
93 | 93 |
94 WebKit::WebCString s = | 94 WebKit::WebCString s = |
95 web_clipboard->readPlainText(ConvertClipboardType(clipboard_type)).utf8(); | 95 web_clipboard->readPlainText(ConvertClipboardType(clipboard_type)).utf8(); |
96 return StringVar::StringToPPVar(instance->module()->pp_module(), s); | 96 return StringVar::StringToPPVar(instance->module()->pp_module(), s); |
97 } | 97 } |
98 | 98 |
99 int32_t WritePlainText(PP_Instance instance_id, | 99 int32_t WritePlainText(PP_Instance instance_id, |
100 PP_Flash_Clipboard_Type clipboard_type, | 100 PP_Flash_Clipboard_Type clipboard_type, |
101 PP_Var text) { | 101 PP_Var text) { |
102 scoped_refptr<StringVar> text_string(StringVar::FromPPVar(text)); | 102 StringVar* text_string = StringVar::FromPPVar(text); |
103 if (!text_string) | 103 if (!text_string) |
104 return PP_ERROR_BADARGUMENT; | 104 return PP_ERROR_BADARGUMENT; |
105 | 105 |
106 if (text_string->value().length() > kMaxClipboardWriteSize) | 106 if (text_string->value().length() > kMaxClipboardWriteSize) |
107 return PP_ERROR_NOSPACE; | 107 return PP_ERROR_NOSPACE; |
108 | 108 |
109 if (clipboard_type != PP_FLASH_CLIPBOARD_TYPE_STANDARD) { | 109 if (clipboard_type != PP_FLASH_CLIPBOARD_TYPE_STANDARD) { |
110 NOTIMPLEMENTED(); | 110 NOTIMPLEMENTED(); |
111 return PP_ERROR_FAILED; | 111 return PP_ERROR_FAILED; |
112 } | 112 } |
(...skipping 18 matching lines...) Expand all Loading... |
131 } // namespace | 131 } // namespace |
132 | 132 |
133 // static | 133 // static |
134 const PPB_Flash_Clipboard* | 134 const PPB_Flash_Clipboard* |
135 PPB_Flash_Clipboard_Impl::GetInterface() { | 135 PPB_Flash_Clipboard_Impl::GetInterface() { |
136 return &ppb_flash_clipboard; | 136 return &ppb_flash_clipboard; |
137 } | 137 } |
138 | 138 |
139 } // namespace ppapi | 139 } // namespace ppapi |
140 } // namespace webkit | 140 } // namespace webkit |
OLD | NEW |