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 NPObject *PluginInstance::GetPluginScriptableObject() { | |
93 NPObject *value = NULL; | |
94 NPError error = NPP_GetValue(NPPVpluginScriptableNPObject, &value); | |
95 if (error != NPERR_NO_ERROR || value == NULL) | |
96 return NULL; | |
97 return value; | |
98 } | |
99 | |
100 bool PluginInstance::GetFormValue(base::string16* value) { | 92 bool PluginInstance::GetFormValue(base::string16* value) { |
101 // Plugins will allocate memory for the return value by using NPN_MemAlloc(). | 93 // Plugins will allocate memory for the return value by using NPN_MemAlloc(). |
102 char *plugin_value = NULL; | 94 char *plugin_value = NULL; |
103 NPError error = NPP_GetValue(NPPVformValue, &plugin_value); | 95 NPError error = NPP_GetValue(NPPVformValue, &plugin_value); |
104 if (error != NPERR_NO_ERROR || !plugin_value) { | 96 if (error != NPERR_NO_ERROR || !plugin_value) { |
105 return false; | 97 return false; |
106 } | 98 } |
107 // Assumes the result is UTF8 text, as Firefox does. | 99 // Assumes the result is UTF8 text, as Firefox does. |
108 *value = base::UTF8ToUTF16(plugin_value); | 100 *value = base::UTF8ToUTF16(plugin_value); |
109 host_->host_functions()->memfree(plugin_value); | 101 host_->host_functions()->memfree(plugin_value); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 if (dest_y) | 411 if (dest_y) |
420 *dest_y = target_y; | 412 *dest_y = target_y; |
421 return true; | 413 return true; |
422 #else | 414 #else |
423 NOTIMPLEMENTED(); | 415 NOTIMPLEMENTED(); |
424 return false; | 416 return false; |
425 #endif | 417 #endif |
426 } | 418 } |
427 | 419 |
428 } // namespace content | 420 } // namespace content |
OLD | NEW |