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/proxy/file_chooser_resource.h" | 5 #include "ppapi/proxy/file_chooser_resource.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 std::string type = type_list[i]; | 86 std::string type = type_list[i]; |
87 base::TrimWhitespaceASCII(type, base::TRIM_ALL, &type); | 87 base::TrimWhitespaceASCII(type, base::TRIM_ALL, &type); |
88 | 88 |
89 // If the type is a single character, it definitely cannot be valid. In the | 89 // If the type is a single character, it definitely cannot be valid. In the |
90 // case of a file extension it would be a single ".". In the case of a MIME | 90 // case of a file extension it would be a single ".". In the case of a MIME |
91 // type it would just be a "/". | 91 // type it would just be a "/". |
92 if (type.length() < 2) | 92 if (type.length() < 2) |
93 continue; | 93 continue; |
94 if (type.find_first_of('/') == std::string::npos && type[0] != '.') | 94 if (type.find_first_of('/') == std::string::npos && type[0] != '.') |
95 continue; | 95 continue; |
96 StringToLowerASCII(&type); | 96 base::StringToLowerASCII(&type); |
97 output->push_back(type); | 97 output->push_back(type); |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 void FileChooserResource::OnPluginMsgShowReply( | 101 void FileChooserResource::OnPluginMsgShowReply( |
102 const ResourceMessageReplyParams& params, | 102 const ResourceMessageReplyParams& params, |
103 const std::vector<FileRefCreateInfo>& chosen_files) { | 103 const std::vector<FileRefCreateInfo>& chosen_files) { |
104 if (output_.is_valid()) { | 104 if (output_.is_valid()) { |
105 // Using v0.6 of the API with the output array. | 105 // Using v0.6 of the API with the output array. |
106 std::vector<PP_Resource> files; | 106 std::vector<PP_Resource> files; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 mode_ == PP_FILECHOOSERMODE_OPENMULTIPLE, | 146 mode_ == PP_FILECHOOSERMODE_OPENMULTIPLE, |
147 sugg_str ? sugg_str->value() : std::string(), | 147 sugg_str ? sugg_str->value() : std::string(), |
148 accept_types_); | 148 accept_types_); |
149 Call<PpapiPluginMsg_FileChooser_ShowReply>(RENDERER, msg, | 149 Call<PpapiPluginMsg_FileChooser_ShowReply>(RENDERER, msg, |
150 base::Bind(&FileChooserResource::OnPluginMsgShowReply, this)); | 150 base::Bind(&FileChooserResource::OnPluginMsgShowReply, this)); |
151 return PP_OK_COMPLETIONPENDING; | 151 return PP_OK_COMPLETIONPENDING; |
152 } | 152 } |
153 | 153 |
154 } // namespace proxy | 154 } // namespace proxy |
155 } // namespace ppapi | 155 } // namespace ppapi |
OLD | NEW |