| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ |
| 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ | 6 #define COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 // use the prefix |metric|. | 384 // use the prefix |metric|. |
| 385 ApplyUpdateResult UpdateHashPrefixMapFromAdditions( | 385 ApplyUpdateResult UpdateHashPrefixMapFromAdditions( |
| 386 const std::string& metric, | 386 const std::string& metric, |
| 387 const ::google::protobuf::RepeatedPtrField<ThreatEntrySet>& additions, | 387 const ::google::protobuf::RepeatedPtrField<ThreatEntrySet>& additions, |
| 388 HashPrefixMap* additions_map); | 388 HashPrefixMap* additions_map); |
| 389 | 389 |
| 390 // Writes the hash_prefix_map_ to disk as a V4StoreFileFormat proto. | 390 // Writes the hash_prefix_map_ to disk as a V4StoreFileFormat proto. |
| 391 // |checksum| is used to set the |checksum| field in the final proto. | 391 // |checksum| is used to set the |checksum| field in the final proto. |
| 392 StoreWriteResult WriteToDisk(const Checksum& checksum); | 392 StoreWriteResult WriteToDisk(const Checksum& checksum); |
| 393 | 393 |
| 394 protected: | |
| 395 HashPrefixMap hash_prefix_map_; | |
| 396 | |
| 397 private: | |
| 398 // The checksum value as read from the disk, until it is verified. Once | 394 // The checksum value as read from the disk, until it is verified. Once |
| 399 // verified, it is cleared. | 395 // verified, it is cleared. |
| 400 std::string expected_checksum_; | 396 std::string expected_checksum_; |
| 401 | 397 |
| 402 // The size of the file on disk for this store. | 398 // The size of the file on disk for this store. |
| 403 int64_t file_size_; | 399 int64_t file_size_; |
| 404 | 400 |
| 405 // True if the file was successfully read+parsed or was populated from | 401 // True if the file was successfully read+parsed or was populated from |
| 406 // a full update. | 402 // a full update. |
| 407 bool has_valid_data_; | 403 bool has_valid_data_; |
| 408 | 404 |
| 409 // The state of the store as returned by the PVer4 server in the last applied | 405 // The state of the store as returned by the PVer4 server in the last applied |
| 410 // update response. | 406 // update response. |
| 411 std::string state_; | 407 std::string state_; |
| 412 const base::FilePath store_path_; | 408 const base::FilePath store_path_; |
| 409 HashPrefixMap hash_prefix_map_; |
| 413 const scoped_refptr<base::SequencedTaskRunner> task_runner_; | 410 const scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 414 }; | 411 }; |
| 415 | 412 |
| 416 std::ostream& operator<<(std::ostream& os, const V4Store& store); | 413 std::ostream& operator<<(std::ostream& os, const V4Store& store); |
| 417 | 414 |
| 418 } // namespace safe_browsing | 415 } // namespace safe_browsing |
| 419 | 416 |
| 420 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ | 417 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ |
| OLD | NEW |