OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "PluginTest.h" | |
6 #include <string.h> | |
7 | |
8 extern NPNetscapeFuncs *browser; | |
9 | |
10 class FormValue : public PluginTest { | |
11 public: | |
12 FormValue(NPP npp, const std::string& identifier) | |
13 : PluginTest(npp, identifier) | |
14 { | |
15 } | |
16 NPError NPP_GetValue(NPPVariable, void*) override; | |
17 }; | |
18 | |
19 NPError FormValue::NPP_GetValue(NPPVariable variable, void *value) | |
20 { | |
21 if (variable == NPPVformValue) { | |
22 static const char formValueText[] = "Plugin form value"; | |
23 *((void**)value) = browser->memalloc(sizeof(formValueText)); | |
24 if (!*((void**)value)) | |
25 return NPERR_OUT_OF_MEMORY_ERROR; | |
26 strncpy(*((char**)value), formValueText, sizeof(formValueText)); | |
27 return NPERR_NO_ERROR; | |
28 } | |
29 return NPERR_GENERIC_ERROR; | |
30 } | |
31 | |
32 static PluginTest::Register<FormValue> formValue("form-value"); | |
OLD | NEW |