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 "content/child/npapi/plugin_instance.h" | 5 #include "content/child/npapi/plugin_instance.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 } | 177 } |
178 | 178 |
179 bool PluginInstance::GetFormValue(base::string16* value) { | 179 bool PluginInstance::GetFormValue(base::string16* value) { |
180 // Plugins will allocate memory for the return value by using NPN_MemAlloc(). | 180 // Plugins will allocate memory for the return value by using NPN_MemAlloc(). |
181 char *plugin_value = NULL; | 181 char *plugin_value = NULL; |
182 NPError error = NPP_GetValue(NPPVformValue, &plugin_value); | 182 NPError error = NPP_GetValue(NPPVformValue, &plugin_value); |
183 if (error != NPERR_NO_ERROR || !plugin_value) { | 183 if (error != NPERR_NO_ERROR || !plugin_value) { |
184 return false; | 184 return false; |
185 } | 185 } |
186 // Assumes the result is UTF8 text, as Firefox does. | 186 // Assumes the result is UTF8 text, as Firefox does. |
187 *value = UTF8ToUTF16(plugin_value); | 187 *value = base::UTF8ToUTF16(plugin_value); |
188 host_->host_functions()->memfree(plugin_value); | 188 host_->host_functions()->memfree(plugin_value); |
189 return true; | 189 return true; |
190 } | 190 } |
191 | 191 |
192 // WebPluginLoadDelegate methods | 192 // WebPluginLoadDelegate methods |
193 void PluginInstance::DidFinishLoadWithReason(const GURL& url, | 193 void PluginInstance::DidFinishLoadWithReason(const GURL& url, |
194 NPReason reason, | 194 NPReason reason, |
195 int notify_id) { | 195 int notify_id) { |
196 bool notify; | 196 bool notify; |
197 void* notify_data; | 197 void* notify_data; |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 if (plugin_stream->notify_data() == notify_data) { | 677 if (plugin_stream->notify_data() == notify_data) { |
678 PluginStreamUrl* plugin_stream_url = | 678 PluginStreamUrl* plugin_stream_url = |
679 static_cast<PluginStreamUrl*>(plugin_stream); | 679 static_cast<PluginStreamUrl*>(plugin_stream); |
680 plugin_stream_url->URLRedirectResponse(allow); | 680 plugin_stream_url->URLRedirectResponse(allow); |
681 break; | 681 break; |
682 } | 682 } |
683 } | 683 } |
684 } | 684 } |
685 | 685 |
686 } // namespace content | 686 } // namespace content |
OLD | NEW |