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 "ppapi/c/dev/ppb_file_chooser_dev.h" | 5 #include "ppapi/c/dev/ppb_file_chooser_dev.h" |
6 #include "ppapi/c/pp_completion_callback.h" | 6 #include "ppapi/c/pp_completion_callback.h" |
7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" | 8 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" |
9 #include "ppapi/shared_impl/tracked_callback.h" | 9 #include "ppapi/shared_impl/tracked_callback.h" |
10 #include "ppapi/shared_impl/var.h" | 10 #include "ppapi/shared_impl/var.h" |
11 #include "ppapi/thunk/enter.h" | 11 #include "ppapi/thunk/enter.h" |
12 #include "ppapi/thunk/thunk.h" | 12 #include "ppapi/thunk/thunk.h" |
13 #include "ppapi/thunk/ppb_file_chooser_api.h" | 13 #include "ppapi/thunk/ppb_file_chooser_api.h" |
14 #include "ppapi/thunk/resource_creation_api.h" | 14 #include "ppapi/thunk/resource_creation_api.h" |
15 | 15 |
16 namespace ppapi { | 16 namespace ppapi { |
17 namespace thunk { | 17 namespace thunk { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 PP_Resource Create(PP_Instance instance, | 21 PP_Resource Create(PP_Instance instance, |
22 PP_FileChooserMode_Dev mode, | 22 PP_FileChooserMode_Dev mode, |
23 struct PP_Var accept_types) { | 23 struct PP_Var accept_types) { |
24 EnterResourceCreation enter(instance); | 24 EnterResourceCreation enter(instance); |
25 if (enter.failed()) | 25 if (enter.failed()) |
26 return 0; | 26 return 0; |
27 scoped_refptr<StringVar> string_var = | 27 scoped_refptr<StringVar> string_var = |
28 StringVar::FromPPVar(accept_types); | 28 StringVar::FromPPVar(accept_types); |
29 std::string str = string_var ? string_var->value() : std::string(); | 29 std::string str = string_var.get() ? string_var->value() : std::string(); |
30 return enter.functions()->CreateFileChooser(instance, mode, str.c_str()); | 30 return enter.functions()->CreateFileChooser(instance, mode, str.c_str()); |
31 } | 31 } |
32 | 32 |
33 PP_Bool IsFileChooser(PP_Resource resource) { | 33 PP_Bool IsFileChooser(PP_Resource resource) { |
34 EnterResource<PPB_FileChooser_API> enter(resource, false); | 34 EnterResource<PPB_FileChooser_API> enter(resource, false); |
35 return PP_FromBool(enter.succeeded()); | 35 return PP_FromBool(enter.succeeded()); |
36 } | 36 } |
37 | 37 |
38 int32_t Show0_5(PP_Resource chooser, PP_CompletionCallback callback) { | 38 int32_t Show0_5(PP_Resource chooser, PP_CompletionCallback callback) { |
39 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); | 39 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 const PPB_FileChooserTrusted_0_5* GetPPB_FileChooserTrusted_0_5_Thunk() { | 115 const PPB_FileChooserTrusted_0_5* GetPPB_FileChooserTrusted_0_5_Thunk() { |
116 return &g_ppb_file_chooser_trusted_0_5_thunk; | 116 return &g_ppb_file_chooser_trusted_0_5_thunk; |
117 } | 117 } |
118 | 118 |
119 const PPB_FileChooserTrusted_0_6* GetPPB_FileChooserTrusted_0_6_Thunk() { | 119 const PPB_FileChooserTrusted_0_6* GetPPB_FileChooserTrusted_0_6_Thunk() { |
120 return &g_ppb_file_chooser_trusted_0_6_thunk; | 120 return &g_ppb_file_chooser_trusted_0_6_thunk; |
121 } | 121 } |
122 | 122 |
123 } // namespace thunk | 123 } // namespace thunk |
124 } // namespace ppapi | 124 } // namespace ppapi |
OLD | NEW |