Roll src/third_party/WebKit dccf813:8daf7c3 (svn 194467:194468)
[chromium-blink-merge.git] / ppapi / thunk / ppb_file_chooser_trusted_thunk.cc
blob2d95be6cb32216122011eb0da19e4a03c610455d
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
3 // found in the LICENSE file.
5 // From trusted/ppb_file_chooser_trusted.idl modified Fri Feb 7 08:29:41 2014.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h"
13 #include "ppapi/thunk/ppb_file_chooser_api.h"
15 namespace ppapi {
16 namespace thunk {
18 namespace {
20 int32_t ShowWithoutUserGesture_0_5(PP_Resource chooser,
21 PP_Bool save_as,
22 struct PP_Var suggested_file_name,
23 struct PP_CompletionCallback callback) {
24 VLOG(4) << "PPB_FileChooserTrusted::ShowWithoutUserGesture_0_5()";
25 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
26 if (enter.failed())
27 return enter.retval();
28 return enter.SetResult(enter.object()->ShowWithoutUserGesture0_5(
29 save_as, suggested_file_name, enter.callback()));
32 int32_t ShowWithoutUserGesture(PP_Resource chooser,
33 PP_Bool save_as,
34 struct PP_Var suggested_file_name,
35 struct PP_ArrayOutput output,
36 struct PP_CompletionCallback callback) {
37 VLOG(4) << "PPB_FileChooserTrusted::ShowWithoutUserGesture()";
38 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
39 if (enter.failed())
40 return enter.retval();
41 return enter.SetResult(enter.object()->ShowWithoutUserGesture(
42 save_as, suggested_file_name, output, enter.callback()));
45 const PPB_FileChooserTrusted_0_5 g_ppb_filechoosertrusted_thunk_0_5 = {
46 &ShowWithoutUserGesture_0_5};
48 const PPB_FileChooserTrusted_0_6 g_ppb_filechoosertrusted_thunk_0_6 = {
49 &ShowWithoutUserGesture};
51 } // namespace
53 PPAPI_THUNK_EXPORT const PPB_FileChooserTrusted_0_5*
54 GetPPB_FileChooserTrusted_0_5_Thunk() {
55 return &g_ppb_filechoosertrusted_thunk_0_5;
58 PPAPI_THUNK_EXPORT const PPB_FileChooserTrusted_0_6*
59 GetPPB_FileChooserTrusted_0_6_Thunk() {
60 return &g_ppb_filechoosertrusted_thunk_0_6;
63 } // namespace thunk
64 } // namespace ppapi