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

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

Issue 13165005: Move FileEnumerator to its own file, do some refactoring. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge, fixes Created 7 years, 7 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
« no previous file with comments | « chrome/common/extensions/extension_l10n_util.cc ('k') | chrome/installer/setup/setup_util.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 "chrome/common/extensions/unpacker.h" 5 #include "chrome/common/extensions/unpacker.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_enumerator.h"
10 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
11 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
12 #include "base/json/json_file_value_serializer.h" 13 #include "base/json/json_file_value_serializer.h"
13 #include "base/memory/scoped_handle.h" 14 #include "base/memory/scoped_handle.h"
14 #include "base/string_util.h" 15 #include "base/string_util.h"
15 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
16 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
17 #include "base/values.h" 18 #include "base/values.h"
18 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" 19 #include "chrome/common/extensions/api/i18n/default_locale_handler.h"
19 #include "chrome/common/extensions/extension.h" 20 #include "chrome/common/extensions/extension.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 121 }
121 122
122 return static_cast<DictionaryValue*>(root.release()); 123 return static_cast<DictionaryValue*>(root.release());
123 } 124 }
124 125
125 bool Unpacker::ReadAllMessageCatalogs(const std::string& default_locale) { 126 bool Unpacker::ReadAllMessageCatalogs(const std::string& default_locale) {
126 base::FilePath locales_path = 127 base::FilePath locales_path =
127 temp_install_dir_.Append(kLocaleFolder); 128 temp_install_dir_.Append(kLocaleFolder);
128 129
129 // Not all folders under _locales have to be valid locales. 130 // Not all folders under _locales have to be valid locales.
130 file_util::FileEnumerator locales(locales_path, 131 base::FileEnumerator locales(locales_path,
131 false, 132 false,
132 file_util::FileEnumerator::DIRECTORIES); 133 base::FileEnumerator::DIRECTORIES);
133 134
134 std::set<std::string> all_locales; 135 std::set<std::string> all_locales;
135 extension_l10n_util::GetAllLocales(&all_locales); 136 extension_l10n_util::GetAllLocales(&all_locales);
136 base::FilePath locale_path; 137 base::FilePath locale_path;
137 while (!(locale_path = locales.Next()).empty()) { 138 while (!(locale_path = locales.Next()).empty()) {
138 if (extension_l10n_util::ShouldSkipValidation(locales_path, locale_path, 139 if (extension_l10n_util::ShouldSkipValidation(locales_path, locale_path,
139 all_locales)) 140 all_locales))
140 continue; 141 continue;
141 142
142 base::FilePath messages_path = locale_path.Append(kMessagesFilename); 143 base::FilePath messages_path = locale_path.Append(kMessagesFilename);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 336
336 void Unpacker::SetError(const std::string &error) { 337 void Unpacker::SetError(const std::string &error) {
337 SetUTF16Error(UTF8ToUTF16(error)); 338 SetUTF16Error(UTF8ToUTF16(error));
338 } 339 }
339 340
340 void Unpacker::SetUTF16Error(const string16 &error) { 341 void Unpacker::SetUTF16Error(const string16 &error) {
341 error_message_ = error; 342 error_message_ = error;
342 } 343 }
343 344
344 } // namespace extensions 345 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_l10n_util.cc ('k') | chrome/installer/setup/setup_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698