| 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 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_FILE_CHOOSER_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_FILE_CHOOSER_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FILE_CHOOSER_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FILE_CHOOSER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 namespace webkit { | 29 namespace webkit { |
| 30 namespace ppapi { | 30 namespace ppapi { |
| 31 | 31 |
| 32 class PPB_FileRef_Impl; | 32 class PPB_FileRef_Impl; |
| 33 | 33 |
| 34 class PPB_FileChooser_Impl : public ::ppapi::Resource, | 34 class PPB_FileChooser_Impl : public ::ppapi::Resource, |
| 35 public ::ppapi::thunk::PPB_FileChooser_API { | 35 public ::ppapi::thunk::PPB_FileChooser_API { |
| 36 public: | 36 public: |
| 37 PPB_FileChooser_Impl(PP_Instance instance, | 37 PPB_FileChooser_Impl(PP_Instance instance, |
| 38 PP_FileChooserMode_Dev mode, | 38 PP_FileChooserMode_Dev mode, |
| 39 const char* accept_mime_types); | 39 const char* accept_types); |
| 40 virtual ~PPB_FileChooser_Impl(); | 40 virtual ~PPB_FileChooser_Impl(); |
| 41 | 41 |
| 42 static PP_Resource Create(PP_Instance instance, | 42 static PP_Resource Create(PP_Instance instance, |
| 43 PP_FileChooserMode_Dev mode, | 43 PP_FileChooserMode_Dev mode, |
| 44 const char* accept_mime_types); | 44 const char* accept_types); |
| 45 | 45 |
| 46 // Resource overrides. | 46 // Resource overrides. |
| 47 virtual PPB_FileChooser_Impl* AsPPB_FileChooser_Impl(); | 47 virtual PPB_FileChooser_Impl* AsPPB_FileChooser_Impl(); |
| 48 | 48 |
| 49 // Resource overrides. | 49 // Resource overrides. |
| 50 virtual ::ppapi::thunk::PPB_FileChooser_API* AsPPB_FileChooser_API() OVERRIDE; | 50 virtual ::ppapi::thunk::PPB_FileChooser_API* AsPPB_FileChooser_API() OVERRIDE; |
| 51 | 51 |
| 52 // Stores the list of selected files. | 52 // Stores the list of selected files. |
| 53 void StoreChosenFiles(const std::vector<std::string>& files); | 53 void StoreChosenFiles(const std::vector<std::string>& files); |
| 54 | 54 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 71 PP_Var suggested_file_name, | 71 PP_Var suggested_file_name, |
| 72 const PP_ArrayOutput& output, | 72 const PP_ArrayOutput& output, |
| 73 const PP_CompletionCallback& callback); | 73 const PP_CompletionCallback& callback); |
| 74 virtual int32_t Show0_5(const PP_CompletionCallback& callback) OVERRIDE; | 74 virtual int32_t Show0_5(const PP_CompletionCallback& callback) OVERRIDE; |
| 75 virtual PP_Resource GetNextChosenFile() OVERRIDE; | 75 virtual PP_Resource GetNextChosenFile() OVERRIDE; |
| 76 virtual int32_t ShowWithoutUserGesture0_5( | 76 virtual int32_t ShowWithoutUserGesture0_5( |
| 77 PP_Bool save_as, | 77 PP_Bool save_as, |
| 78 PP_Var suggested_file_name, | 78 PP_Var suggested_file_name, |
| 79 const PP_CompletionCallback& callback) OVERRIDE; | 79 const PP_CompletionCallback& callback) OVERRIDE; |
| 80 | 80 |
| 81 // Splits a comma-separated MIME type list |accept_mime_types|, trims the | 81 // Splits a comma-separated MIME type/extension list |accept_types|, trims the |
| 82 // resultant split types, makes them lowercase, and returns them. | 82 // resultant split types, makes them lowercase, and returns them. |
| 83 // Though this should be private, this is public for testing. | 83 // Though this should be private, this is public for testing. |
| 84 WEBKIT_PLUGINS_EXPORT static std::vector<WebKit::WebString> ParseAcceptValue( | 84 WEBKIT_PLUGINS_EXPORT static std::vector<WebKit::WebString> ParseAcceptValue( |
| 85 const std::string& accept_mime_types); | 85 const std::string& accept_types); |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 PP_FileChooserMode_Dev mode_; | 88 PP_FileChooserMode_Dev mode_; |
| 89 std::string accept_mime_types_; | 89 std::string accept_types_; |
| 90 scoped_refptr< ::ppapi::TrackedCallback> callback_; | 90 scoped_refptr< ::ppapi::TrackedCallback> callback_; |
| 91 | 91 |
| 92 // When using the v0.6 of the API, this will contain the output for the | 92 // When using the v0.6 of the API, this will contain the output for the |
| 93 // resources when the show command is complete. When using 0.5, this | 93 // resources when the show command is complete. When using 0.5, this |
| 94 // object will be is_null() and the chosen_files_ will be used instead. | 94 // object will be is_null() and the chosen_files_ will be used instead. |
| 95 ::ppapi::ArrayWriter output_; | 95 ::ppapi::ArrayWriter output_; |
| 96 | 96 |
| 97 // Used to store and iterate over the results when using 0.5 of the API. | 97 // Used to store and iterate over the results when using 0.5 of the API. |
| 98 // These are valid when we get a file result and output_ is not null. | 98 // These are valid when we get a file result and output_ is not null. |
| 99 std::vector< scoped_refptr<Resource> > chosen_files_; | 99 std::vector< scoped_refptr<Resource> > chosen_files_; |
| 100 size_t next_chosen_file_index_; | 100 size_t next_chosen_file_index_; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 } // namespace ppapi | 103 } // namespace ppapi |
| 104 } // namespace webkit | 104 } // namespace webkit |
| 105 | 105 |
| 106 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FILE_CHOOSER_IMPL_H_ | 106 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FILE_CHOOSER_IMPL_H_ |
| OLD | NEW |