OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <math.h> | 5 #include <math.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "ppapi/cpp/instance.h" | 9 #include "ppapi/cpp/instance.h" |
10 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
11 #include "ppapi/cpp/var.h" | 11 #include "ppapi/cpp/var.h" |
12 #include "ppapi/cpp/var_dictionary.h" | 12 #include "ppapi/cpp/var_dictionary.h" |
13 | 13 |
14 #ifdef WIN32 | 14 #ifdef WIN32 |
15 #undef PostMessage | 15 #undef PostMessage |
16 // Allow 'this' in initializer list | 16 // Allow 'this' in initializer list |
17 #pragma warning(disable : 4355) | 17 #pragma warning(disable : 4355) |
18 #endif | 18 #endif |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 static const char kGetCommand[] = "Get"; | 22 static const char kGetCommand[] = "Get"; |
23 static const char kSetCommand[] = "Set"; | 23 static const char kSetCommand[] = "Set"; |
24 static const char kDeleteCommand[] = "Delete"; | 24 static const char kDeleteCommand[] = "Delete"; |
25 static const char kHasKeyCommand[] = "HasKey"; | 25 static const char kHasKeyCommand[] = "HasKey"; |
26 static const char kGetKeysCommand[] = "GetKeys"; | 26 static const char kGetKeysCommand[] = "GetKeys"; |
27 | 27 |
28 static const char kCommandKey[] = "cmd"; | |
29 | |
30 pp::Var MakeResult(const char* cmd, const pp::Var& value, | 28 pp::Var MakeResult(const char* cmd, const pp::Var& value, |
31 const pp::Var& newDictionary) { | 29 const pp::Var& newDictionary) { |
32 pp::VarDictionary dict; | 30 pp::VarDictionary dict; |
33 dict.Set("cmd", cmd); | 31 dict.Set("cmd", cmd); |
34 dict.Set("result", value); | 32 dict.Set("result", value); |
35 dict.Set("dict", newDictionary); | 33 dict.Set("dict", newDictionary); |
36 return dict; | 34 return dict; |
37 } | 35 } |
38 | 36 |
39 } // namespace | 37 } // namespace |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 virtual ~VarDictionaryModule() {} | 147 virtual ~VarDictionaryModule() {} |
150 | 148 |
151 virtual pp::Instance* CreateInstance(PP_Instance instance) { | 149 virtual pp::Instance* CreateInstance(PP_Instance instance) { |
152 return new VarDictionaryInstance(instance); | 150 return new VarDictionaryInstance(instance); |
153 } | 151 } |
154 }; | 152 }; |
155 | 153 |
156 namespace pp { | 154 namespace pp { |
157 Module* CreateModule() { return new VarDictionaryModule(); } | 155 Module* CreateModule() { return new VarDictionaryModule(); } |
158 } // namespace pp | 156 } // namespace pp |
OLD | NEW |