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