| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 bool load_manually) { | 84 bool load_manually) { |
| 85 load_manually_ = load_manually; | 85 load_manually_ = load_manually; |
| 86 unsigned short mode = load_manually_ ? NP_FULL : NP_EMBED; | 86 unsigned short mode = load_manually_ ? NP_FULL : NP_EMBED; |
| 87 npp_->ndata = this; | 87 npp_->ndata = this; |
| 88 | 88 |
| 89 NPError err = NPP_New(mode, param_count, | 89 NPError err = NPP_New(mode, param_count, |
| 90 const_cast<char **>(param_names), const_cast<char **>(param_values)); | 90 const_cast<char **>(param_names), const_cast<char **>(param_values)); |
| 91 return err == NPERR_NO_ERROR; | 91 return err == NPERR_NO_ERROR; |
| 92 } | 92 } |
| 93 | 93 |
| 94 NPObject *PluginInstance::GetPluginScriptableObject() { | |
| 95 NPObject *value = NULL; | |
| 96 NPError error = NPP_GetValue(NPPVpluginScriptableNPObject, &value); | |
| 97 if (error != NPERR_NO_ERROR || value == NULL) | |
| 98 return NULL; | |
| 99 return value; | |
| 100 } | |
| 101 | |
| 102 bool PluginInstance::GetFormValue(base::string16* value) { | 94 bool PluginInstance::GetFormValue(base::string16* value) { |
| 103 // Plugins will allocate memory for the return value by using NPN_MemAlloc(). | 95 // Plugins will allocate memory for the return value by using NPN_MemAlloc(). |
| 104 char *plugin_value = NULL; | 96 char *plugin_value = NULL; |
| 105 NPError error = NPP_GetValue(NPPVformValue, &plugin_value); | 97 NPError error = NPP_GetValue(NPPVformValue, &plugin_value); |
| 106 if (error != NPERR_NO_ERROR || !plugin_value) { | 98 if (error != NPERR_NO_ERROR || !plugin_value) { |
| 107 return false; | 99 return false; |
| 108 } | 100 } |
| 109 // Assumes the result is UTF8 text, as Firefox does. | 101 // Assumes the result is UTF8 text, as Firefox does. |
| 110 *value = base::UTF8ToUTF16(plugin_value); | 102 *value = base::UTF8ToUTF16(plugin_value); |
| 111 host_->host_functions()->memfree(plugin_value); | 103 host_->host_functions()->memfree(plugin_value); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 if (dest_y) | 413 if (dest_y) |
| 422 *dest_y = target_y; | 414 *dest_y = target_y; |
| 423 return true; | 415 return true; |
| 424 #else | 416 #else |
| 425 NOTIMPLEMENTED(); | 417 NOTIMPLEMENTED(); |
| 426 return false; | 418 return false; |
| 427 #endif | 419 #endif |
| 428 } | 420 } |
| 429 | 421 |
| 430 } // namespace content | 422 } // namespace content |
| OLD | NEW |