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

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: export AssertLockHeld Created 8 years, 6 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
« no previous file with comments | « ppapi/thunk/ppb_file_chooser_api.h ('k') | ppapi/thunk/ppb_file_io_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/tracked_callback.h"
9 #include "ppapi/shared_impl/var.h" 10 #include "ppapi/shared_impl/var.h"
10 #include "ppapi/thunk/enter.h" 11 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/thunk.h" 12 #include "ppapi/thunk/thunk.h"
12 #include "ppapi/thunk/ppb_file_chooser_api.h" 13 #include "ppapi/thunk/ppb_file_chooser_api.h"
13 #include "ppapi/thunk/resource_creation_api.h" 14 #include "ppapi/thunk/resource_creation_api.h"
14 15
15 namespace ppapi { 16 namespace ppapi {
16 namespace thunk { 17 namespace thunk {
17 18
18 namespace { 19 namespace {
(...skipping 12 matching lines...) Expand all
31 32
32 PP_Bool IsFileChooser(PP_Resource resource) { 33 PP_Bool IsFileChooser(PP_Resource resource) {
33 EnterResource<PPB_FileChooser_API> enter(resource, false); 34 EnterResource<PPB_FileChooser_API> enter(resource, false);
34 return PP_FromBool(enter.succeeded()); 35 return PP_FromBool(enter.succeeded());
35 } 36 }
36 37
37 int32_t Show0_5(PP_Resource chooser, PP_CompletionCallback callback) { 38 int32_t Show0_5(PP_Resource chooser, PP_CompletionCallback callback) {
38 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); 39 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
39 if (enter.failed()) 40 if (enter.failed())
40 return enter.retval(); 41 return enter.retval();
41 return enter.SetResult(enter.object()->Show0_5(callback)); 42 return enter.SetResult(enter.object()->Show0_5(enter.callback()));
42 } 43 }
43 44
44 PP_Resource GetNextChosenFile0_5(PP_Resource chooser) { 45 PP_Resource GetNextChosenFile0_5(PP_Resource chooser) {
45 EnterResource<PPB_FileChooser_API> enter(chooser, true); 46 EnterResource<PPB_FileChooser_API> enter(chooser, true);
46 if (enter.failed()) 47 if (enter.failed())
47 return 0; 48 return 0;
48 return enter.object()->GetNextChosenFile(); 49 return enter.object()->GetNextChosenFile();
49 } 50 }
50 51
51 int32_t Show(PP_Resource chooser, 52 int32_t Show(PP_Resource chooser,
52 PP_ArrayOutput output, 53 PP_ArrayOutput output,
53 PP_CompletionCallback callback) { 54 PP_CompletionCallback callback) {
54 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); 55 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
55 if (enter.failed()) 56 if (enter.failed())
56 return enter.retval(); 57 return enter.retval();
57 return enter.SetResult(enter.object()->Show(output, callback)); 58 return enter.SetResult(enter.object()->Show(output, enter.callback()));
58 } 59 }
59 60
60 int32_t ShowWithoutUserGesture0_5(PP_Resource chooser, 61 int32_t ShowWithoutUserGesture0_5(PP_Resource chooser,
61 PP_Bool save_as, 62 PP_Bool save_as,
62 PP_Var suggested_file_name, 63 PP_Var suggested_file_name,
63 PP_CompletionCallback callback) { 64 PP_CompletionCallback callback) {
64 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); 65 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
65 if (enter.failed()) 66 if (enter.failed())
66 return enter.retval(); 67 return enter.retval();
67 return enter.SetResult(enter.object()->ShowWithoutUserGesture0_5( 68 return enter.SetResult(enter.object()->ShowWithoutUserGesture0_5(
68 save_as, suggested_file_name, callback)); 69 save_as, suggested_file_name, enter.callback()));
69 } 70 }
70 71
71 int32_t ShowWithoutUserGesture0_6(PP_Resource chooser, 72 int32_t ShowWithoutUserGesture0_6(PP_Resource chooser,
72 PP_Bool save_as, 73 PP_Bool save_as,
73 PP_Var suggested_file_name, 74 PP_Var suggested_file_name,
74 PP_ArrayOutput output, 75 PP_ArrayOutput output,
75 PP_CompletionCallback callback) { 76 PP_CompletionCallback callback) {
76 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true); 77 EnterResource<PPB_FileChooser_API> enter(chooser, callback, true);
77 if (enter.failed()) 78 if (enter.failed())
78 return enter.retval(); 79 return enter.retval();
79 return enter.SetResult(enter.object()->ShowWithoutUserGesture( 80 return enter.SetResult(enter.object()->ShowWithoutUserGesture(
80 save_as, suggested_file_name, output, callback)); 81 save_as, suggested_file_name, output, enter.callback()));
81 } 82 }
82 83
83 const PPB_FileChooser_Dev_0_5 g_ppb_file_chooser_0_5_thunk = { 84 const PPB_FileChooser_Dev_0_5 g_ppb_file_chooser_0_5_thunk = {
84 &Create, 85 &Create,
85 &IsFileChooser, 86 &IsFileChooser,
86 &Show0_5, 87 &Show0_5,
87 &GetNextChosenFile0_5 88 &GetNextChosenFile0_5
88 }; 89 };
89 90
90 const PPB_FileChooser_Dev_0_6 g_ppb_file_chooser_0_6_thunk = { 91 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() { 115 const PPB_FileChooserTrusted_0_5* GetPPB_FileChooserTrusted_0_5_Thunk() {
115 return &g_ppb_file_chooser_trusted_0_5_thunk; 116 return &g_ppb_file_chooser_trusted_0_5_thunk;
116 } 117 }
117 118
118 const PPB_FileChooserTrusted_0_6* GetPPB_FileChooserTrusted_0_6_Thunk() { 119 const PPB_FileChooserTrusted_0_6* GetPPB_FileChooserTrusted_0_6_Thunk() {
119 return &g_ppb_file_chooser_trusted_0_6_thunk; 120 return &g_ppb_file_chooser_trusted_0_6_thunk;
120 } 121 }
121 122
122 } // namespace thunk 123 } // namespace thunk
123 } // namespace ppapi 124 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_file_chooser_api.h ('k') | ppapi/thunk/ppb_file_io_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698