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