Index: ppapi/cpp/trusted/file_chooser_trusted.cc |
diff --git a/ppapi/cpp/trusted/file_chooser_trusted.cc b/ppapi/cpp/trusted/file_chooser_trusted.cc |
index a5f68791737cc2c53d1758f19bd068c28b8890c8..5d0c707fbd26e86cd908074e19a4ec197aeaf332 100644 |
--- a/ppapi/cpp/trusted/file_chooser_trusted.cc |
+++ b/ppapi/cpp/trusted/file_chooser_trusted.cc |
@@ -15,8 +15,12 @@ namespace pp { |
namespace { |
-template <> const char* interface_name<PPB_FileChooserTrusted>() { |
- return PPB_FILECHOOSER_TRUSTED_INTERFACE; |
+template <> const char* interface_name<PPB_FileChooserTrusted_0_5>() { |
+ return PPB_FILECHOOSER_TRUSTED_INTERFACE_0_5; |
+} |
+ |
+template <> const char* interface_name<PPB_FileChooserTrusted_0_6>() { |
+ return PPB_FILECHOOSER_TRUSTED_INTERFACE_0_6; |
} |
} // namespace |
@@ -48,14 +52,28 @@ FileChooser_Trusted& FileChooser_Trusted::operator=( |
return *this; |
} |
-int32_t FileChooser_Trusted::Show(const CompletionCallback& cc) { |
- if (!has_interface<PPB_FileChooserTrusted>()) |
- return cc.MayForce(PP_ERROR_NOINTERFACE); |
- return get_interface<PPB_FileChooserTrusted>()->ShowWithoutUserGesture( |
- pp_resource(), |
- PP_FromBool(save_as_), |
- Var(suggested_file_name_).pp_var(), |
- cc.pp_completion_callback()); |
+int32_t FileChooser_Trusted::Show( |
+ const CompletionCallbackWithOutput< std::vector<FileRef> >& callback) { |
+ if (has_interface<PPB_FileChooserTrusted_0_6>()) { |
+ return get_interface<PPB_FileChooserTrusted_0_6>()->ShowWithoutUserGesture( |
+ pp_resource(), |
+ PP_FromBool(save_as_), |
+ Var(suggested_file_name_).pp_var(), |
+ callback.output(), |
+ callback.pp_completion_callback()); |
+ } else if (has_interface<PPB_FileChooserTrusted_0_5>()) { |
viettrungluu
2012/03/26 16:55:19
No |else|, apparently.
|
+ // Data for out callback. The callback handler will delete it. |
viettrungluu
2012/03/26 16:55:19
"out"?
|
+ ChooseCallbackData0_5* data = new ChooseCallbackData0_5; |
+ data->file_chooser = pp_resource(); |
+ data->output = callback.output(); |
+ |
+ return get_interface<PPB_FileChooserTrusted_0_5>()->ShowWithoutUserGesture( |
+ pp_resource(), |
+ PP_FromBool(save_as_), |
+ Var(suggested_file_name_).pp_var(), |
+ PP_MakeCompletionCallback(&CallbackConverter, data)); |
+ } |
+ return callback.MayForce(PP_ERROR_NOINTERFACE); |
} |
} // namespace pp |