| 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 <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 bool load_manually) { | 82 bool load_manually) { |
| 83 load_manually_ = load_manually; | 83 load_manually_ = load_manually; |
| 84 unsigned short mode = load_manually_ ? NP_FULL : NP_EMBED; | 84 unsigned short mode = load_manually_ ? NP_FULL : NP_EMBED; |
| 85 npp_->ndata = this; | 85 npp_->ndata = this; |
| 86 | 86 |
| 87 NPError err = NPP_New(mode, param_count, | 87 NPError err = NPP_New(mode, param_count, |
| 88 const_cast<char **>(param_names), const_cast<char **>(param_values)); | 88 const_cast<char **>(param_names), const_cast<char **>(param_values)); |
| 89 return err == NPERR_NO_ERROR; | 89 return err == NPERR_NO_ERROR; |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool PluginInstance::GetFormValue(base::string16* value) { | |
| 93 // Plugins will allocate memory for the return value by using NPN_MemAlloc(). | |
| 94 char *plugin_value = NULL; | |
| 95 NPError error = NPP_GetValue(NPPVformValue, &plugin_value); | |
| 96 if (error != NPERR_NO_ERROR || !plugin_value) { | |
| 97 return false; | |
| 98 } | |
| 99 // Assumes the result is UTF8 text, as Firefox does. | |
| 100 *value = base::UTF8ToUTF16(plugin_value); | |
| 101 host_->host_functions()->memfree(plugin_value); | |
| 102 return true; | |
| 103 } | |
| 104 | |
| 105 unsigned PluginInstance::GetBackingTextureId() { | 92 unsigned PluginInstance::GetBackingTextureId() { |
| 106 // By default the plugin instance is not backed by an OpenGL texture. | 93 // By default the plugin instance is not backed by an OpenGL texture. |
| 107 return 0; | 94 return 0; |
| 108 } | 95 } |
| 109 | 96 |
| 110 // NPAPI methods | 97 // NPAPI methods |
| 111 NPError PluginInstance::NPP_New(unsigned short mode, | 98 NPError PluginInstance::NPP_New(unsigned short mode, |
| 112 short argc, | 99 short argc, |
| 113 char* argn[], | 100 char* argn[], |
| 114 char* argv[]) { | 101 char* argv[]) { |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 if (dest_y) | 398 if (dest_y) |
| 412 *dest_y = target_y; | 399 *dest_y = target_y; |
| 413 return true; | 400 return true; |
| 414 #else | 401 #else |
| 415 NOTIMPLEMENTED(); | 402 NOTIMPLEMENTED(); |
| 416 return false; | 403 return false; |
| 417 #endif | 404 #endif |
| 418 } | 405 } |
| 419 | 406 |
| 420 } // namespace content | 407 } // namespace content |
| OLD | NEW |