| 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 #ifndef EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_ | 5 #ifndef EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_ |
| 6 #define EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_ | 6 #define EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 | 11 |
| 10 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 14 | 17 |
| 15 namespace base { | 18 namespace base { |
| 16 class FilePath; | 19 class FilePath; |
| 17 } | 20 } |
| 18 | 21 |
| 19 namespace crypto { | 22 namespace crypto { |
| 20 class SecureHash; | 23 class SecureHash; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 bool done_reading_; | 116 bool done_reading_; |
| 114 | 117 |
| 115 // Set to true once hash_reader_ has read its expected hashes. | 118 // Set to true once hash_reader_ has read its expected hashes. |
| 116 bool hashes_ready_; | 119 bool hashes_ready_; |
| 117 | 120 |
| 118 // While we're waiting for the callback from the ContentHashReader, we need | 121 // While we're waiting for the callback from the ContentHashReader, we need |
| 119 // to queue up bytes any bytes that are read. | 122 // to queue up bytes any bytes that are read. |
| 120 std::string queue_; | 123 std::string queue_; |
| 121 | 124 |
| 122 // The total bytes we've read. | 125 // The total bytes we've read. |
| 123 int64 total_bytes_read_; | 126 int64_t total_bytes_read_; |
| 124 | 127 |
| 125 // The index of the block we're currently on. | 128 // The index of the block we're currently on. |
| 126 int current_block_; | 129 int current_block_; |
| 127 | 130 |
| 128 // The hash we're building up for the bytes of |current_block_|. | 131 // The hash we're building up for the bytes of |current_block_|. |
| 129 scoped_ptr<crypto::SecureHash> current_hash_; | 132 scoped_ptr<crypto::SecureHash> current_hash_; |
| 130 | 133 |
| 131 // The number of bytes we've already input into |current_hash_|. | 134 // The number of bytes we've already input into |current_hash_|. |
| 132 int current_hash_byte_count_; | 135 int current_hash_byte_count_; |
| 133 | 136 |
| 134 scoped_refptr<ContentHashReader> hash_reader_; | 137 scoped_refptr<ContentHashReader> hash_reader_; |
| 135 | 138 |
| 136 base::TimeDelta time_spent_; | 139 base::TimeDelta time_spent_; |
| 137 | 140 |
| 138 // Called once if verification fails. | 141 // Called once if verification fails. |
| 139 FailureCallback failure_callback_; | 142 FailureCallback failure_callback_; |
| 140 | 143 |
| 141 // Set to true if we detected a mismatch and called the failure callback. | 144 // Set to true if we detected a mismatch and called the failure callback. |
| 142 bool failed_; | 145 bool failed_; |
| 143 | 146 |
| 144 // For ensuring methods on called on the right thread. | 147 // For ensuring methods on called on the right thread. |
| 145 base::ThreadChecker thread_checker_; | 148 base::ThreadChecker thread_checker_; |
| 146 }; | 149 }; |
| 147 | 150 |
| 148 } // namespace extensions | 151 } // namespace extensions |
| 149 | 152 |
| 150 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_ | 153 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_ |
| OLD | NEW |