| 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 (const base::FilePath& path : image_paths) { | 188 for (std::set<base::FilePath>::iterator it = image_paths.begin(); |
| 189 if (!AddDecodedImage(path)) | 189 it != image_paths.end(); ++it) { |
| 190 if (!AddDecodedImage(*it)) |
| 190 return false; // Error was already reported. | 191 return false; // Error was already reported. |
| 191 } | 192 } |
| 192 | 193 |
| 193 // Parse all message catalogs (if any). | 194 // Parse all message catalogs (if any). |
| 194 parsed_catalogs_.reset(new base::DictionaryValue); | 195 parsed_catalogs_.reset(new base::DictionaryValue); |
| 195 if (!LocaleInfo::GetDefaultLocale(extension.get()).empty()) { | 196 if (!LocaleInfo::GetDefaultLocale(extension.get()).empty()) { |
| 196 if (!ReadAllMessageCatalogs(LocaleInfo::GetDefaultLocale(extension.get()))) | 197 if (!ReadAllMessageCatalogs(LocaleInfo::GetDefaultLocale(extension.get()))) |
| 197 return false; // Error was already reported. | 198 return false; // Error was already reported. |
| 198 } | 199 } |
| 199 | 200 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 288 |
| 288 void Unpacker::SetError(const std::string& error) { | 289 void Unpacker::SetError(const std::string& error) { |
| 289 SetUTF16Error(base::UTF8ToUTF16(error)); | 290 SetUTF16Error(base::UTF8ToUTF16(error)); |
| 290 } | 291 } |
| 291 | 292 |
| 292 void Unpacker::SetUTF16Error(const base::string16& error) { | 293 void Unpacker::SetUTF16Error(const base::string16& error) { |
| 293 error_message_ = error; | 294 error_message_ = error; |
| 294 } | 295 } |
| 295 | 296 |
| 296 } // namespace extensions | 297 } // namespace extensions |
| OLD | NEW |