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 "extensions/utility/unpacker.h" | 5 #include "extensions/utility/unpacker.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 std::vector<InstallWarning> warnings; | 178 std::vector<InstallWarning> warnings; |
179 if (!file_util::ValidateExtension(extension.get(), &error, &warnings)) { | 179 if (!file_util::ValidateExtension(extension.get(), &error, &warnings)) { |
180 SetError(error); | 180 SetError(error); |
181 return false; | 181 return false; |
182 } | 182 } |
183 extension->AddInstallWarnings(warnings); | 183 extension->AddInstallWarnings(warnings); |
184 | 184 |
185 // Decode any images that the browser needs to display. | 185 // Decode any images that the browser needs to display. |
186 std::set<base::FilePath> image_paths = | 186 std::set<base::FilePath> image_paths = |
187 ExtensionsClient::Get()->GetBrowserImagePaths(extension.get()); | 187 ExtensionsClient::Get()->GetBrowserImagePaths(extension.get()); |
188 for (std::set<base::FilePath>::iterator it = image_paths.begin(); | 188 for (const base::FilePath& path : image_paths) { |
189 it != image_paths.end(); ++it) { | 189 if (!AddDecodedImage(path)) |
190 if (!AddDecodedImage(*it)) | |
191 return false; // Error was already reported. | 190 return false; // Error was already reported. |
192 } | 191 } |
193 | 192 |
194 // Parse all message catalogs (if any). | 193 // Parse all message catalogs (if any). |
195 parsed_catalogs_.reset(new base::DictionaryValue); | 194 parsed_catalogs_.reset(new base::DictionaryValue); |
196 if (!LocaleInfo::GetDefaultLocale(extension.get()).empty()) { | 195 if (!LocaleInfo::GetDefaultLocale(extension.get()).empty()) { |
197 if (!ReadAllMessageCatalogs(LocaleInfo::GetDefaultLocale(extension.get()))) | 196 if (!ReadAllMessageCatalogs(LocaleInfo::GetDefaultLocale(extension.get()))) |
198 return false; // Error was already reported. | 197 return false; // Error was already reported. |
199 } | 198 } |
200 | 199 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 287 |
289 void Unpacker::SetError(const std::string& error) { | 288 void Unpacker::SetError(const std::string& error) { |
290 SetUTF16Error(base::UTF8ToUTF16(error)); | 289 SetUTF16Error(base::UTF8ToUTF16(error)); |
291 } | 290 } |
292 | 291 |
293 void Unpacker::SetUTF16Error(const base::string16& error) { | 292 void Unpacker::SetUTF16Error(const base::string16& error) { |
294 error_message_ = error; | 293 error_message_ = error; |
295 } | 294 } |
296 | 295 |
297 } // namespace extensions | 296 } // namespace extensions |
OLD | NEW |