OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_input_event.h" | 6 #include "ppapi/c/pp_input_event.h" |
7 #include "ppapi/cpp/completion_callback.h" | 7 #include "ppapi/cpp/completion_callback.h" |
8 #include "ppapi/cpp/dev/file_chooser_dev.h" | 8 #include "ppapi/cpp/dev/file_chooser_dev.h" |
9 #include "ppapi/cpp/file_ref.h" | 9 #include "ppapi/cpp/file_ref.h" |
10 #include "ppapi/cpp/input_event.h" | 10 #include "ppapi/cpp/input_event.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 private: | 42 private: |
43 void ShowFileChooser(bool multi_select) { | 43 void ShowFileChooser(bool multi_select) { |
44 RecreateConsole(); | 44 RecreateConsole(); |
45 | 45 |
46 PP_FileChooserMode_Dev mode = | 46 PP_FileChooserMode_Dev mode = |
47 (multi_select ? PP_FILECHOOSERMODE_OPENMULTIPLE | 47 (multi_select ? PP_FILECHOOSERMODE_OPENMULTIPLE |
48 : PP_FILECHOOSERMODE_OPEN); | 48 : PP_FILECHOOSERMODE_OPEN); |
49 std::string accept_mime_types = (multi_select ? "" : "plain/text"); | 49 std::string accept_types = (multi_select ? "" : "plain/text"); |
50 | 50 |
51 chooser_ = pp::FileChooser_Dev(this, mode, accept_mime_types); | 51 chooser_ = pp::FileChooser_Dev(this, mode, accept_types); |
52 chooser_.Show(callback_factory_.NewCallbackWithOutput( | 52 chooser_.Show(callback_factory_.NewCallbackWithOutput( |
53 &MyInstance::ShowSelectedFileNames)); | 53 &MyInstance::ShowSelectedFileNames)); |
54 } | 54 } |
55 | 55 |
56 void ShowSelectedFileNames(int32_t result, | 56 void ShowSelectedFileNames(int32_t result, |
57 const std::vector<pp::FileRef>& files) { | 57 const std::vector<pp::FileRef>& files) { |
58 if (result != PP_OK) | 58 if (result != PP_OK) |
59 return; | 59 return; |
60 for (size_t i = 0; i < files.size(); i++) | 60 for (size_t i = 0; i < files.size(); i++) |
61 Log(files[i].GetName()); | 61 Log(files[i].GetName()); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 }; | 96 }; |
97 | 97 |
98 namespace pp { | 98 namespace pp { |
99 | 99 |
100 // Factory function for your specialization of the Module object. | 100 // Factory function for your specialization of the Module object. |
101 Module* CreateModule() { | 101 Module* CreateModule() { |
102 return new MyModule(); | 102 return new MyModule(); |
103 } | 103 } |
104 | 104 |
105 } // namespace pp | 105 } // namespace pp |
OLD | NEW |