Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: components/safe_browsing_db/v4_store.h

Issue 2675063002: Browser tests for using the new SafeBrowsing protocol (v4) (Closed)
Patch Set: Simplify V4DB creation in product code and tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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:
394 // The checksum value as read from the disk, until it is verified. Once 398 // The checksum value as read from the disk, until it is verified. Once
395 // verified, it is cleared. 399 // verified, it is cleared.
396 std::string expected_checksum_; 400 std::string expected_checksum_;
397 401
398 // The size of the file on disk for this store. 402 // The size of the file on disk for this store.
399 int64_t file_size_; 403 int64_t file_size_;
400 404
401 // True if the file was successfully read+parsed or was populated from 405 // True if the file was successfully read+parsed or was populated from
402 // a full update. 406 // a full update.
403 bool has_valid_data_; 407 bool has_valid_data_;
404 408
405 // The state of the store as returned by the PVer4 server in the last applied 409 // The state of the store as returned by the PVer4 server in the last applied
406 // update response. 410 // update response.
407 std::string state_; 411 std::string state_;
408 const base::FilePath store_path_; 412 const base::FilePath store_path_;
409 HashPrefixMap hash_prefix_map_;
410 const scoped_refptr<base::SequencedTaskRunner> task_runner_; 413 const scoped_refptr<base::SequencedTaskRunner> task_runner_;
411 }; 414 };
412 415
413 std::ostream& operator<<(std::ostream& os, const V4Store& store); 416 std::ostream& operator<<(std::ostream& os, const V4Store& store);
414 417
415 } // namespace safe_browsing 418 } // namespace safe_browsing
416 419
417 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_ 420 #endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698