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