| 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 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 ContentVerifyJob* ContentVerifier::CreateJobFor( | 53 ContentVerifyJob* ContentVerifier::CreateJobFor( |
| 54 const std::string& extension_id, | 54 const std::string& extension_id, |
| 55 const base::FilePath& extension_root, | 55 const base::FilePath& extension_root, |
| 56 const base::FilePath& relative_path) { | 56 const base::FilePath& relative_path) { |
| 57 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 57 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 58 | 58 |
| 59 const ContentVerifierIOData::ExtensionData* data = | 59 const ContentVerifierIOData::ExtensionData* data = |
| 60 io_data_->GetData(extension_id); | 60 io_data_->GetData(extension_id); |
| 61 if (!data) | 61 if (!data) |
| 62 return NULL; | 62 return nullptr; |
| 63 | 63 |
| 64 std::set<base::FilePath> paths; | 64 std::set<base::FilePath> paths; |
| 65 paths.insert(relative_path); | 65 paths.insert(relative_path); |
| 66 if (!ShouldVerifyAnyPaths(extension_id, extension_root, paths)) | 66 if (!ShouldVerifyAnyPaths(extension_id, extension_root, paths)) |
| 67 return NULL; | 67 return nullptr; |
| 68 | 68 |
| 69 // TODO(asargent) - we can probably get some good performance wins by having | 69 // TODO(asargent) - we can probably get some good performance wins by having |
| 70 // a cache of ContentHashReader's that we hold onto past the end of each job. | 70 // a cache of ContentHashReader's that we hold onto past the end of each job. |
| 71 return new ContentVerifyJob( | 71 return new ContentVerifyJob( |
| 72 new ContentHashReader(extension_id, | 72 new ContentHashReader(extension_id, |
| 73 data->version, | 73 data->version, |
| 74 extension_root, | 74 extension_root, |
| 75 relative_path, | 75 relative_path, |
| 76 delegate_->PublicKey()), | 76 delegate_->PublicKey()), |
| 77 base::Bind(&ContentVerifier::VerifyFailed, this, extension_id)); | 77 base::Bind(&ContentVerifier::VerifyFailed, this, extension_id)); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 !extension_l10n_util::ShouldSkipValidation( | 229 !extension_l10n_util::ShouldSkipValidation( |
| 230 locales_dir, full_path.DirName(), *all_locales)) | 230 locales_dir, full_path.DirName(), *all_locales)) |
| 231 continue; | 231 continue; |
| 232 } | 232 } |
| 233 return true; | 233 return true; |
| 234 } | 234 } |
| 235 return false; | 235 return false; |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace extensions | 238 } // namespace extensions |
| OLD | NEW |