| 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> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <string> | 11 #include <string> |
| 11 | 12 |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class FilePath; | 19 class FilePath; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace crypto { | 22 namespace crypto { |
| 23 class SecureHash; | 23 class SecureHash; |
| 24 } | 24 } |
| 25 | 25 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // to queue up bytes any bytes that are read. | 122 // to queue up bytes any bytes that are read. |
| 123 std::string queue_; | 123 std::string queue_; |
| 124 | 124 |
| 125 // The total bytes we've read. | 125 // The total bytes we've read. |
| 126 int64_t total_bytes_read_; | 126 int64_t total_bytes_read_; |
| 127 | 127 |
| 128 // The index of the block we're currently on. | 128 // The index of the block we're currently on. |
| 129 int current_block_; | 129 int current_block_; |
| 130 | 130 |
| 131 // 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_|. |
| 132 scoped_ptr<crypto::SecureHash> current_hash_; | 132 std::unique_ptr<crypto::SecureHash> current_hash_; |
| 133 | 133 |
| 134 // The number of bytes we've already input into |current_hash_|. | 134 // The number of bytes we've already input into |current_hash_|. |
| 135 int current_hash_byte_count_; | 135 int current_hash_byte_count_; |
| 136 | 136 |
| 137 scoped_refptr<ContentHashReader> hash_reader_; | 137 scoped_refptr<ContentHashReader> hash_reader_; |
| 138 | 138 |
| 139 base::TimeDelta time_spent_; | 139 base::TimeDelta time_spent_; |
| 140 | 140 |
| 141 // Called once if verification fails. | 141 // Called once if verification fails. |
| 142 FailureCallback failure_callback_; | 142 FailureCallback failure_callback_; |
| 143 | 143 |
| 144 // 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. |
| 145 bool failed_; | 145 bool failed_; |
| 146 | 146 |
| 147 // For ensuring methods on called on the right thread. | 147 // For ensuring methods on called on the right thread. |
| 148 base::ThreadChecker thread_checker_; | 148 base::ThreadChecker thread_checker_; |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace extensions | 151 } // namespace extensions |
| 152 | 152 |
| 153 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_ | 153 #endif // EXTENSIONS_BROWSER_CONTENT_VERIFY_JOB_H_ |
| OLD | NEW |