| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_FILE_CHOOSER_H_ | 5 #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_FILE_CHOOSER_H_ |
| 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_FILE_CHOOSER_H_ | 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_FILE_CHOOSER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
| 9 | 10 |
| 11 #include "base/scoped_ptr.h" |
| 12 #include "third_party/ppapi/c/pp_completion_callback.h" |
| 10 #include "third_party/ppapi/c/ppb_file_chooser.h" | 13 #include "third_party/ppapi/c/ppb_file_chooser.h" |
| 11 #include "webkit/glue/plugins/pepper_resource.h" | 14 #include "webkit/glue/plugins/pepper_resource.h" |
| 12 | 15 |
| 13 namespace pepper { | 16 namespace pepper { |
| 14 | 17 |
| 18 class PluginDelegate; |
| 15 class PluginInstance; | 19 class PluginInstance; |
| 16 | 20 |
| 17 class FileChooser : public Resource { | 21 class FileChooser : public Resource { |
| 18 public: | 22 public: |
| 19 FileChooser(PluginInstance* instance, const PP_FileChooserOptions* options); | 23 FileChooser(PluginInstance* instance, const PP_FileChooserOptions* options); |
| 20 virtual ~FileChooser(); | 24 virtual ~FileChooser(); |
| 21 | 25 |
| 22 // Returns a pointer to the interface implementing PPB_FileChooser that is | 26 // Returns a pointer to the interface implementing PPB_FileChooser that is |
| 23 // exposed to the plugin. | 27 // exposed to the plugin. |
| 24 static const PPB_FileChooser* GetInterface(); | 28 static const PPB_FileChooser* GetInterface(); |
| 25 | 29 |
| 26 // Resource overrides. | 30 // Resource overrides. |
| 27 FileChooser* AsFileChooser() { return this; } | 31 FileChooser* AsFileChooser() { return this; } |
| 28 | 32 |
| 33 // Stores the list of selected files. |
| 34 void StoreChosenFiles(const std::vector<std::string>& files); |
| 35 |
| 29 // PPB_FileChooser implementation. | 36 // PPB_FileChooser implementation. |
| 30 int32_t Show(PP_CompletionCallback callback); | 37 int32_t Show(PP_CompletionCallback callback); |
| 31 scoped_refptr<FileRef> GetNextChosenFile(); | 38 scoped_refptr<FileRef> GetNextChosenFile(); |
| 32 | 39 |
| 33 private: | 40 private: |
| 41 PluginDelegate* delegate_; |
| 34 PP_FileChooserMode mode_; | 42 PP_FileChooserMode mode_; |
| 35 std::string accept_mime_types_; | 43 std::string accept_mime_types_; |
| 44 PP_CompletionCallback completion_callback_; |
| 45 std::vector<scoped_refptr<FileRef> > chosen_files_; |
| 46 size_t next_chosen_file_index_; |
| 36 }; | 47 }; |
| 37 | 48 |
| 38 } // namespace pepper | 49 } // namespace pepper |
| 39 | 50 |
| 40 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_FILE_CHOOSER_H_ | 51 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_FILE_CHOOSER_H_ |
| OLD | NEW |