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

Side by Side Diff: ppapi/proxy/file_chooser_resource.cc

Issue 1284833004: Remove remaining legacy SplitString calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « pdf/out_of_process_instance.cc ('k') | remoting/client/plugin/chromoting_instance.cc » ('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) 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return ShowInternal(save_as, suggested_file_name, callback); 71 return ShowInternal(save_as, suggested_file_name, callback);
72 } 72 }
73 73
74 // static 74 // static
75 void FileChooserResource::PopulateAcceptTypes( 75 void FileChooserResource::PopulateAcceptTypes(
76 const std::string& input, 76 const std::string& input,
77 std::vector<std::string>* output) { 77 std::vector<std::string>* output) {
78 if (input.empty()) 78 if (input.empty())
79 return; 79 return;
80 80
81 std::vector<std::string> type_list; 81 std::vector<std::string> type_list = base::SplitString(
82 base::SplitString(input, ',', &type_list); 82 input, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
83 output->reserve(type_list.size()); 83 output->reserve(type_list.size());
84 84
85 for (size_t i = 0; i < type_list.size(); ++i) { 85 for (size_t i = 0; i < type_list.size(); ++i) {
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)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 mode_ == PP_FILECHOOSERMODE_OPENMULTIPLE, 145 mode_ == PP_FILECHOOSERMODE_OPENMULTIPLE,
146 sugg_str ? sugg_str->value() : std::string(), 146 sugg_str ? sugg_str->value() : std::string(),
147 accept_types_); 147 accept_types_);
148 Call<PpapiPluginMsg_FileChooser_ShowReply>(RENDERER, msg, 148 Call<PpapiPluginMsg_FileChooser_ShowReply>(RENDERER, msg,
149 base::Bind(&FileChooserResource::OnPluginMsgShowReply, this)); 149 base::Bind(&FileChooserResource::OnPluginMsgShowReply, this));
150 return PP_OK_COMPLETIONPENDING; 150 return PP_OK_COMPLETIONPENDING;
151 } 151 }
152 152
153 } // namespace proxy 153 } // namespace proxy
154 } // namespace ppapi 154 } // namespace ppapi
OLDNEW
« no previous file with comments | « pdf/out_of_process_instance.cc ('k') | remoting/client/plugin/chromoting_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698