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