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

Side by Side Diff: chrome/browser/prefs/pref_hash_store_impl.h

Issue 324493002: Move preference MACs to the protected preference stores. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to CR comments. Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ 5 #ifndef CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_
6 #define CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ 6 #define CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 18 matching lines...) Expand all
29 // No hashes have been stored in this PrefHashStore yet. 29 // No hashes have been stored in this PrefHashStore yet.
30 VERSION_UNINITIALIZED = 0, 30 VERSION_UNINITIALIZED = 0,
31 // The hashes in this PrefHashStore were stored before the introduction 31 // The hashes in this PrefHashStore were stored before the introduction
32 // of a version number and should be re-initialized. 32 // of a version number and should be re-initialized.
33 VERSION_PRE_MIGRATION = 1, 33 VERSION_PRE_MIGRATION = 1,
34 // The hashes in this PrefHashStore were stored using the latest algorithm. 34 // The hashes in this PrefHashStore were stored using the latest algorithm.
35 VERSION_LATEST = 2, 35 VERSION_LATEST = 2,
36 }; 36 };
37 37
38 // Constructs a PrefHashStoreImpl that calculates hashes using 38 // Constructs a PrefHashStoreImpl that calculates hashes using
39 // |seed| and |device_id| and stores them in |contents|. 39 // |seed| and |device_id|
40 //
41 // The same |seed| and |device_id| must be used to load and validate
42 // previously stored hashes in |contents|.
43 PrefHashStoreImpl(const std::string& seed, 40 PrefHashStoreImpl(const std::string& seed,
44 const std::string& device_id, 41 const std::string& device_id,
45 scoped_ptr<HashStoreContents> contents); 42 bool use_super_mac);
46 43
47 virtual ~PrefHashStoreImpl(); 44 virtual ~PrefHashStoreImpl();
48 45
49 // Clears the contents of this PrefHashStore. |IsInitialized()| will return 46 // Configures this |PrefHashStoreImpl| to store MACs in and retrieve MACs from
50 // false after this call. 47 // |contents|.
51 void Reset(); 48 void SetHashStoreContents(scoped_ptr<HashStoreContents> contents);
52 49
53 // PrefHashStore implementation. 50 // PrefHashStore implementation.
51 virtual bool IsInitialized() const OVERRIDE;
52 virtual void Reset() OVERRIDE;
54 virtual scoped_ptr<PrefHashStoreTransaction> BeginTransaction() OVERRIDE; 53 virtual scoped_ptr<PrefHashStoreTransaction> BeginTransaction() OVERRIDE;
55 virtual void CommitPendingWrite() OVERRIDE; 54 virtual void CommitPendingWrite() OVERRIDE;
56 55
57 // Returns the current version of this hash store.
58 StoreVersion GetCurrentVersion() const;
59
60 private: 56 private:
61 class PrefHashStoreTransactionImpl; 57 class PrefHashStoreTransactionImpl;
62 58
59 bool CheckSuperMac();
60
63 const PrefHashCalculator pref_hash_calculator_; 61 const PrefHashCalculator pref_hash_calculator_;
64 scoped_ptr<HashStoreContents> contents_; 62 scoped_ptr<HashStoreContents> contents_;
65 const bool initial_hashes_dictionary_trusted_; 63 bool use_super_mac_;
64
65 bool checked_super_mac_;
66 bool initial_hashes_dictionary_trusted_;
66 67
67 // True if hashes have been modified since the last call to 68 // True if hashes have been modified since the last call to
68 // CommitPendingWriteIfRequired(). 69 // CommitPendingWriteIfRequired().
69 bool has_pending_write_; 70 bool has_pending_write_;
70 71
71 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); 72 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl);
72 }; 73 };
73 74
74 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ 75 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698