| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/content_verifier.h" | 5 #include "extensions/browser/content_verifier.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 std::unique_ptr<std::set<std::string>> all_locales; | 254 std::unique_ptr<std::set<std::string>> all_locales; |
| 255 | 255 |
| 256 for (std::set<base::FilePath>::const_iterator i = relative_paths.begin(); | 256 for (std::set<base::FilePath>::const_iterator i = relative_paths.begin(); |
| 257 i != relative_paths.end(); | 257 i != relative_paths.end(); |
| 258 ++i) { | 258 ++i) { |
| 259 const base::FilePath& relative_path = *i; | 259 const base::FilePath& relative_path = *i; |
| 260 | 260 |
| 261 if (relative_path == base::FilePath(kManifestFilename)) | 261 if (relative_path == base::FilePath(kManifestFilename)) |
| 262 continue; | 262 continue; |
| 263 | 263 |
| 264 if (ContainsKey(browser_images, relative_path)) | 264 if (base::ContainsKey(browser_images, relative_path)) |
| 265 continue; | 265 continue; |
| 266 | 266 |
| 267 base::FilePath full_path = extension_root.Append(relative_path); | 267 base::FilePath full_path = extension_root.Append(relative_path); |
| 268 if (locales_dir.IsParent(full_path)) { | 268 if (locales_dir.IsParent(full_path)) { |
| 269 if (!all_locales) { | 269 if (!all_locales) { |
| 270 // TODO(asargent) - see if we can cache this list longer to avoid | 270 // TODO(asargent) - see if we can cache this list longer to avoid |
| 271 // having to fetch it more than once for a given run of the | 271 // having to fetch it more than once for a given run of the |
| 272 // browser. Maybe it can never change at runtime? (Or if it can, maybe | 272 // browser. Maybe it can never change at runtime? (Or if it can, maybe |
| 273 // there is an event we can listen for to know to drop our cache). | 273 // there is an event we can listen for to know to drop our cache). |
| 274 all_locales.reset(new std::set<std::string>); | 274 all_locales.reset(new std::set<std::string>); |
| 275 extension_l10n_util::GetAllLocales(all_locales.get()); | 275 extension_l10n_util::GetAllLocales(all_locales.get()); |
| 276 } | 276 } |
| 277 | 277 |
| 278 // Since message catalogs get transcoded during installation, we want | 278 // Since message catalogs get transcoded during installation, we want |
| 279 // to skip those paths. | 279 // to skip those paths. |
| 280 if (full_path.DirName().DirName() == locales_dir && | 280 if (full_path.DirName().DirName() == locales_dir && |
| 281 !extension_l10n_util::ShouldSkipValidation( | 281 !extension_l10n_util::ShouldSkipValidation( |
| 282 locales_dir, full_path.DirName(), *all_locales)) | 282 locales_dir, full_path.DirName(), *all_locales)) |
| 283 continue; | 283 continue; |
| 284 } | 284 } |
| 285 return true; | 285 return true; |
| 286 } | 286 } |
| 287 return false; | 287 return false; |
| 288 } | 288 } |
| 289 | 289 |
| 290 } // namespace extensions | 290 } // namespace extensions |
| OLD | NEW |