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

Side by Side Diff: chrome/browser/file_select_helper.cc

Issue 176843022: Move UTF16ToASCII, remove WideToASCII. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
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 "chrome/browser/file_select_helper.h" 5 #include "chrome/browser/file_select_helper.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 new ui::SelectFileDialog::FileTypeInfo(*base_file_type)); 243 new ui::SelectFileDialog::FileTypeInfo(*base_file_type));
244 file_type->include_all_files = true; 244 file_type->include_all_files = true;
245 file_type->extensions.resize(1); 245 file_type->extensions.resize(1);
246 std::vector<base::FilePath::StringType>* extensions = 246 std::vector<base::FilePath::StringType>* extensions =
247 &file_type->extensions.back(); 247 &file_type->extensions.back();
248 248
249 // Find the corresponding extensions. 249 // Find the corresponding extensions.
250 int valid_type_count = 0; 250 int valid_type_count = 0;
251 int description_id = 0; 251 int description_id = 0;
252 for (size_t i = 0; i < accept_types.size(); ++i) { 252 for (size_t i = 0; i < accept_types.size(); ++i) {
253 std::string ascii_type = UTF16ToASCII(accept_types[i]); 253 std::string ascii_type = base::UTF16ToASCII(accept_types[i]);
254 if (!IsAcceptTypeValid(ascii_type)) 254 if (!IsAcceptTypeValid(ascii_type))
255 continue; 255 continue;
256 256
257 size_t old_extension_size = extensions->size(); 257 size_t old_extension_size = extensions->size();
258 if (ascii_type[0] == '.') { 258 if (ascii_type[0] == '.') {
259 // If the type starts with a period it is assumed to be a file extension 259 // If the type starts with a period it is assumed to be a file extension
260 // so we just have to add it to the list. 260 // so we just have to add it to the list.
261 base::FilePath::StringType ext(ascii_type.begin(), ascii_type.end()); 261 base::FilePath::StringType ext(ascii_type.begin(), ascii_type.end());
262 extensions->push_back(ext.substr(1)); 262 extensions->push_back(ext.substr(1));
263 } else { 263 } else {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 // of an extension or a "/" in the case of a MIME type). 478 // of an extension or a "/" in the case of a MIME type).
479 std::string unused; 479 std::string unused;
480 if (accept_type.length() <= 1 || 480 if (accept_type.length() <= 1 ||
481 StringToLowerASCII(accept_type) != accept_type || 481 StringToLowerASCII(accept_type) != accept_type ||
482 base::TrimWhitespaceASCII(accept_type, base::TRIM_ALL, &unused) != 482 base::TrimWhitespaceASCII(accept_type, base::TRIM_ALL, &unused) !=
483 base::TRIM_NONE) { 483 base::TRIM_NONE) {
484 return false; 484 return false;
485 } 485 }
486 return true; 486 return true;
487 } 487 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_registry_loader_win.cc ('k') | chrome/browser/google/google_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698