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
3 // found in the LICENSE file.
5 #include "ppapi/c/ppb_var_dictionary.h"
6 #include "ppapi/c/pp_bool.h"
7 #include "ppapi/c/pp_var.h"
8 #include "ppapi/shared_impl/dictionary_var.h"
9 #include "ppapi/shared_impl/proxy_lock.h"
10 #include "ppapi/thunk/thunk.h"
20 // Var tracker will hold a reference to this object.
21 DictionaryVar
* var
= new DictionaryVar();
22 return var
->GetPPVar();
25 PP_Var
Get(PP_Var dict
, PP_Var key
) {
28 DictionaryVar
* dict_var
= DictionaryVar::FromPPVar(dict
);
30 return PP_MakeUndefined();
31 return dict_var
->Get(key
);
34 PP_Bool
Set(PP_Var dict
, PP_Var key
, PP_Var value
) {
37 DictionaryVar
* dict_var
= DictionaryVar::FromPPVar(dict
);
41 return dict_var
->Set(key
, value
);
44 void Delete(PP_Var dict
, PP_Var key
) {
47 DictionaryVar
* dict_var
= DictionaryVar::FromPPVar(dict
);
49 dict_var
->Delete(key
);
52 PP_Bool
HasKey(PP_Var dict
, PP_Var key
) {
55 DictionaryVar
* dict_var
= DictionaryVar::FromPPVar(dict
);
58 return dict_var
->HasKey(key
);
61 PP_Var
GetKeys(PP_Var dict
) {
64 DictionaryVar
* dict_var
= DictionaryVar::FromPPVar(dict
);
67 return dict_var
->GetKeys();
70 const PPB_VarDictionary_1_0 g_ppb_vardictionary_1_0_thunk
= {
81 const PPB_VarDictionary_1_0
* GetPPB_VarDictionary_1_0_Thunk() {
82 return &g_ppb_vardictionary_1_0_thunk
;