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

Side by Side Diff: ppapi/examples/file_chooser/file_chooser.cc

Issue 10414085: Modified the pepper file chooser API to support filtering files by extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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/cpp/trusted/file_chooser_trusted.cc ('k') | ppapi/proxy/ppapi_messages.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) 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
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
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
OLDNEW
« no previous file with comments | « ppapi/cpp/trusted/file_chooser_trusted.cc ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698