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

Side by Side Diff: chrome/common/extensions/extension_l10n_util.cc

Issue 6597075: FilePath: add a convertor to ASCII (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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
« base/file_path.h ('K') | « chrome/browser/spellcheck_host.cc ('k') | no next file » | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/common/extensions/extension_l10n_util.h" 5 #include "chrome/common/extensions/extension_l10n_util.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 return ExtensionMessageBundle::Create(catalogs, error); 270 return ExtensionMessageBundle::Create(catalogs, error);
271 } 271 }
272 272
273 bool ShouldSkipValidation(const FilePath& locales_path, 273 bool ShouldSkipValidation(const FilePath& locales_path,
274 const FilePath& locale_path, 274 const FilePath& locale_path,
275 const std::set<std::string>& all_locales) { 275 const std::set<std::string>& all_locales) {
276 // Since we use this string as a key in a DictionaryValue, be paranoid about 276 // Since we use this string as a key in a DictionaryValue, be paranoid about
277 // skipping any strings with '.'. This happens sometimes, for example with 277 // skipping any strings with '.'. This happens sometimes, for example with
278 // '.svn' directories. 278 // '.svn' directories.
279 FilePath relative_path; 279 FilePath relative_path;
280 if (!locales_path.AppendRelativePath(locale_path, &relative_path)) 280 if (!locales_path.AppendRelativePath(locale_path, &relative_path)) {
281 NOTREACHED(); 281 NOTREACHED();
282 std::wstring subdir(relative_path.ToWStringHack()); 282 return true;
283 if (std::find(subdir.begin(), subdir.end(), L'.') != subdir.end()) 283 }
284 std::string subdir = relative_path.MaybeAsASCII();
285 if (subdir.empty())
286 return true; // Non-ASCII.
287
288 if (std::find(subdir.begin(), subdir.end(), '.') != subdir.end())
284 return true; 289 return true;
285 290
286 if (all_locales.find(WideToASCII(subdir)) == all_locales.end()) 291 if (all_locales.find(subdir) == all_locales.end())
287 return true; 292 return true;
288 293
289 return false; 294 return false;
290 } 295 }
291 296
292 } // namespace extension_l10n_util 297 } // namespace extension_l10n_util
OLDNEW
« base/file_path.h ('K') | « chrome/browser/spellcheck_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698