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 #include "ppapi/cpp/trusted/file_chooser_trusted.h" | 5 #include "ppapi/cpp/trusted/file_chooser_trusted.h" |
6 | 6 |
7 #include "ppapi/c/pp_bool.h" | 7 #include "ppapi/c/pp_bool.h" |
8 #include "ppapi/cpp/completion_callback.h" | 8 #include "ppapi/cpp/completion_callback.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
11 #include "ppapi/cpp/var.h" | 11 #include "ppapi/cpp/var.h" |
12 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" | 12 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" |
13 | 13 |
14 namespace pp { | 14 namespace pp { |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 template <> const char* interface_name<PPB_FileChooserTrusted>() { | 18 template <> const char* interface_name<PPB_FileChooserTrusted>() { |
19 return PPB_FILECHOOSER_TRUSTED_INTERFACE; | 19 return PPB_FILECHOOSER_TRUSTED_INTERFACE; |
20 } | 20 } |
21 | 21 |
22 } // namespace | 22 } // namespace |
23 | 23 |
24 FileChooser_Trusted::FileChooser_Trusted() : save_as_(false) { | 24 FileChooser_Trusted::FileChooser_Trusted() : save_as_(false) { |
25 } | 25 } |
26 | 26 |
27 FileChooser_Trusted::FileChooser_Trusted(const Instance* instance, | 27 FileChooser_Trusted::FileChooser_Trusted(const InstanceHandle& instance, |
28 PP_FileChooserMode_Dev mode, | 28 PP_FileChooserMode_Dev mode, |
29 const Var& accept_mime_types, | 29 const Var& accept_mime_types, |
30 bool save_as, | 30 bool save_as, |
31 const std::string& suggested_file_name) | 31 const std::string& suggested_file_name) |
32 : FileChooser_Dev(instance, mode, accept_mime_types), | 32 : FileChooser_Dev(instance, mode, accept_mime_types), |
33 save_as_(save_as), | 33 save_as_(save_as), |
34 suggested_file_name_(suggested_file_name) { | 34 suggested_file_name_(suggested_file_name) { |
35 } | 35 } |
36 | 36 |
37 FileChooser_Trusted::FileChooser_Trusted(const FileChooser_Trusted& other) | 37 FileChooser_Trusted::FileChooser_Trusted(const FileChooser_Trusted& other) |
(...skipping 14 matching lines...) Expand all Loading... |
52 if (!has_interface<PPB_FileChooserTrusted>()) | 52 if (!has_interface<PPB_FileChooserTrusted>()) |
53 return cc.MayForce(PP_ERROR_NOINTERFACE); | 53 return cc.MayForce(PP_ERROR_NOINTERFACE); |
54 return get_interface<PPB_FileChooserTrusted>()->ShowWithoutUserGesture( | 54 return get_interface<PPB_FileChooserTrusted>()->ShowWithoutUserGesture( |
55 pp_resource(), | 55 pp_resource(), |
56 PP_FromBool(save_as_), | 56 PP_FromBool(save_as_), |
57 Var(suggested_file_name_).pp_var(), | 57 Var(suggested_file_name_).pp_var(), |
58 cc.pp_completion_callback()); | 58 cc.pp_completion_callback()); |
59 } | 59 } |
60 | 60 |
61 } // namespace pp | 61 } // namespace pp |
OLD | NEW |