Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Side by Side Diff: ppapi/thunk/ppb_file_chooser_thunk.cc

Issue 10081020: PPAPI: Make blocking completion callbacks work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated TestURLLoader to test blocking callbacks. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 20 matching lines...) Expand all
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) {
38 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); 38 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
39 if (enter.failed()) 39 if (enter.failed())
40 return enter.retval(); 40 return enter.retval();
41 return enter.SetResult(enter.object()->Show0_5(callback)); 41 return enter.SetResult(enter.object()->Show0_5(enter.callback()));
42 } 42 }
43 43
44 PP_Resource GetNextChosenFile0_5(PP_Resource chooser) { 44 PP_Resource GetNextChosenFile0_5(PP_Resource chooser) {
45 EnterResource<PPB_FileChooser_API> enter(chooser, true); 45 EnterResource<PPB_FileChooser_API> enter(chooser, true);
46 if (enter.failed()) 46 if (enter.failed())
47 return 0; 47 return 0;
48 return enter.object()->GetNextChosenFile(); 48 return enter.object()->GetNextChosenFile();
49 } 49 }
50 50
51 int32_t Show(PP_Resource chooser, 51 int32_t Show(PP_Resource chooser,
52 PP_ArrayOutput output, 52 PP_ArrayOutput output,
53 PP_CompletionCallback callback) { 53 PP_CompletionCallback callback) {
54 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); 54 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
55 if (enter.failed()) 55 if (enter.failed())
56 return enter.retval(); 56 return enter.retval();
57 return enter.SetResult(enter.object()->Show(output, callback)); 57 return enter.SetResult(enter.object()->Show(output, enter.callback()));
58 } 58 }
59 59
60 int32_t ShowWithoutUserGesture0_5(PP_Resource chooser, 60 int32_t ShowWithoutUserGesture0_5(PP_Resource chooser,
61 PP_Bool save_as, 61 PP_Bool save_as,
62 PP_Var suggested_file_name, 62 PP_Var suggested_file_name,
63 PP_CompletionCallback callback) { 63 PP_CompletionCallback callback) {
64 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); 64 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
65 if (enter.failed()) 65 if (enter.failed())
66 return enter.retval(); 66 return enter.retval();
67 return enter.SetResult(enter.object()->ShowWithoutUserGesture0_5( 67 return enter.SetResult(enter.object()->ShowWithoutUserGesture0_5(
68 save_as, suggested_file_name, callback)); 68 save_as, suggested_file_name, enter.callback()));
69 } 69 }
70 70
71 int32_t ShowWithoutUserGesture0_6(PP_Resource chooser, 71 int32_t ShowWithoutUserGesture0_6(PP_Resource chooser,
72 PP_Bool save_as, 72 PP_Bool save_as,
73 PP_Var suggested_file_name, 73 PP_Var suggested_file_name,
74 PP_ArrayOutput output, 74 PP_ArrayOutput output,
75 PP_CompletionCallback callback) { 75 PP_CompletionCallback callback) {
76 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); 76 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
77 if (enter.failed()) 77 if (enter.failed())
78 return enter.retval(); 78 return enter.retval();
79 return enter.SetResult(enter.object()->ShowWithoutUserGesture( 79 return enter.SetResult(enter.object()->ShowWithoutUserGesture(
80 save_as, suggested_file_name, output, callback)); 80 save_as, suggested_file_name, output, enter.callback()));
81 } 81 }
82 82
83 const PPB_FileChooser_Dev_0_5 g_ppb_file_chooser_0_5_thunk = { 83 const PPB_FileChooser_Dev_0_5 g_ppb_file_chooser_0_5_thunk = {
84 &Create, 84 &Create,
85 &IsFileChooser, 85 &IsFileChooser,
86 &Show0_5, 86 &Show0_5,
87 &GetNextChosenFile0_5 87 &GetNextChosenFile0_5
88 }; 88 };
89 89
90 const PPB_FileChooser_Dev_0_6 g_ppb_file_chooser_0_6_thunk = { 90 const PPB_FileChooser_Dev_0_6 g_ppb_file_chooser_0_6_thunk = {
(...skipping 23 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698