| 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 // From trusted/ppb_file_chooser_trusted.idl, | 5 // From trusted/ppb_file_chooser_trusted.idl modified Mon May 6 10:11:29 2013. |
| 6 // modified Tue Aug 20 08:13:36 2013. | |
| 7 | 6 |
| 8 #include "ppapi/c/pp_completion_callback.h" | 7 #include "ppapi/c/pp_completion_callback.h" |
| 9 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" | 9 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" |
| 11 #include "ppapi/shared_impl/tracked_callback.h" | 10 #include "ppapi/shared_impl/tracked_callback.h" |
| 12 #include "ppapi/thunk/enter.h" | 11 #include "ppapi/thunk/enter.h" |
| 13 #include "ppapi/thunk/ppapi_thunk_export.h" | 12 #include "ppapi/thunk/ppapi_thunk_export.h" |
| 14 #include "ppapi/thunk/ppb_file_chooser_api.h" | 13 #include "ppapi/thunk/ppb_file_chooser_api.h" |
| 15 | 14 |
| 16 namespace ppapi { | 15 namespace ppapi { |
| 17 namespace thunk { | 16 namespace thunk { |
| 18 | 17 |
| 19 namespace { | 18 namespace { |
| 20 | 19 |
| 21 int32_t ShowWithoutUserGesture_0_5(PP_Resource chooser, | 20 int32_t ShowWithoutUserGesture_0_5(PP_Resource chooser, |
| 22 PP_Bool save_as, | 21 PP_Bool save_as, |
| 23 struct PP_Var suggested_file_name, | 22 struct PP_Var suggested_file_name, |
| 24 struct PP_CompletionCallback callback) { | 23 struct PP_CompletionCallback callback) { |
| 25 VLOG(4) << "PPB_FileChooserTrusted::ShowWithoutUserGesture()"; | 24 VLOG(4) << "PPB_FileChooserTrusted::ShowWithoutUserGesture()"; |
| 26 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); | 25 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); |
| 27 if (enter.failed()) | 26 if (enter.failed()) |
| 28 return enter.retval(); | 27 return enter.retval(); |
| 29 return enter.SetResult(enter.object()->ShowWithoutUserGesture0_5( | 28 return enter.SetResult(enter.object()->ShowWithoutUserGesture0_5( |
| 30 save_as, | 29 save_as, suggested_file_name, enter.callback())); |
| 31 suggested_file_name, | |
| 32 enter.callback())); | |
| 33 } | 30 } |
| 34 | 31 |
| 35 int32_t ShowWithoutUserGesture(PP_Resource chooser, | 32 int32_t ShowWithoutUserGesture(PP_Resource chooser, |
| 36 PP_Bool save_as, | 33 PP_Bool save_as, |
| 37 struct PP_Var suggested_file_name, | 34 struct PP_Var suggested_file_name, |
| 38 struct PP_ArrayOutput output, | 35 struct PP_ArrayOutput output, |
| 39 struct PP_CompletionCallback callback) { | 36 struct PP_CompletionCallback callback) { |
| 40 VLOG(4) << "PPB_FileChooserTrusted::ShowWithoutUserGesture()"; | 37 VLOG(4) << "PPB_FileChooserTrusted::ShowWithoutUserGesture()"; |
| 41 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); | 38 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); |
| 42 if (enter.failed()) | 39 if (enter.failed()) |
| 43 return enter.retval(); | 40 return enter.retval(); |
| 44 return enter.SetResult(enter.object()->ShowWithoutUserGesture( | 41 return enter.SetResult(enter.object()->ShowWithoutUserGesture( |
| 45 save_as, | 42 save_as, suggested_file_name, output, enter.callback())); |
| 46 suggested_file_name, | |
| 47 output, | |
| 48 enter.callback())); | |
| 49 } | 43 } |
| 50 | 44 |
| 51 const PPB_FileChooserTrusted_0_5 g_ppb_filechoosertrusted_thunk_0_5 = { | 45 const PPB_FileChooserTrusted_0_5 g_ppb_filechoosertrusted_thunk_0_5 = { // |
| 52 &ShowWithoutUserGesture_0_5 | 46 &ShowWithoutUserGesture_0_5 // |
| 53 }; | 47 }; |
| 54 | 48 |
| 55 const PPB_FileChooserTrusted_0_6 g_ppb_filechoosertrusted_thunk_0_6 = { | 49 const PPB_FileChooserTrusted_0_6 g_ppb_filechoosertrusted_thunk_0_6 = { // |
| 56 &ShowWithoutUserGesture | 50 &ShowWithoutUserGesture // |
| 57 }; | 51 }; |
| 58 | 52 |
| 59 } // namespace | 53 } // namespace |
| 60 | 54 |
| 61 PPAPI_THUNK_EXPORT const PPB_FileChooserTrusted_0_5* | 55 PPAPI_THUNK_EXPORT const PPB_FileChooserTrusted_0_5* |
| 62 GetPPB_FileChooserTrusted_0_5_Thunk() { | 56 GetPPB_FileChooserTrusted_0_5_Thunk() { |
| 63 return &g_ppb_filechoosertrusted_thunk_0_5; | 57 return &g_ppb_filechoosertrusted_thunk_0_5; |
| 64 } | 58 } |
| 65 | 59 |
| 66 PPAPI_THUNK_EXPORT const PPB_FileChooserTrusted_0_6* | 60 PPAPI_THUNK_EXPORT const PPB_FileChooserTrusted_0_6* |
| 67 GetPPB_FileChooserTrusted_0_6_Thunk() { | 61 GetPPB_FileChooserTrusted_0_6_Thunk() { |
| 68 return &g_ppb_filechoosertrusted_thunk_0_6; | 62 return &g_ppb_filechoosertrusted_thunk_0_6; |
| 69 } | 63 } |
| 70 | 64 |
| 71 } // namespace thunk | 65 } // namespace thunk |
| 72 } // namespace ppapi | 66 } // namespace ppapi |
| OLD | NEW |