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

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: Comment typo. 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
« no previous file with comments | « chrome/browser/prefs/pref_hash_store.h ('k') | chrome/browser/prefs/pref_hash_store_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/prefs/pref_hash_calculator.h" 13 #include "chrome/browser/prefs/pref_hash_calculator.h"
14 #include "chrome/browser/prefs/pref_hash_store.h" 14 #include "chrome/browser/prefs/pref_hash_store.h"
15 15
16 class HashStoreContents; 16 class HashStoreContents;
17 class PrefHashStoreTransaction; 17 class PrefHashStoreTransaction;
18 18
19 namespace base {
20 class DictionaryValue;
21 class Value;
22 }
23
24 // Implements PrefHashStoreImpl by storing preference hashes in a 19 // Implements PrefHashStoreImpl by storing preference hashes in a
25 // HashStoreContents. 20 // HashStoreContents.
26 class PrefHashStoreImpl : public PrefHashStore { 21 class PrefHashStoreImpl : public PrefHashStore {
27 public: 22 public:
28 enum StoreVersion { 23 enum StoreVersion {
29 // No hashes have been stored in this PrefHashStore yet. 24 // No hashes have been stored in this PrefHashStore yet.
30 VERSION_UNINITIALIZED = 0, 25 VERSION_UNINITIALIZED = 0,
31 // The hashes in this PrefHashStore were stored before the introduction 26 // The hashes in this PrefHashStore were stored before the introduction
32 // of a version number and should be re-initialized. 27 // of a version number and should be re-initialized.
33 VERSION_PRE_MIGRATION = 1, 28 VERSION_PRE_MIGRATION = 1,
34 // The hashes in this PrefHashStore were stored using the latest algorithm. 29 // The hashes in this PrefHashStore were stored using the latest algorithm.
35 VERSION_LATEST = 2, 30 VERSION_LATEST = 2,
36 }; 31 };
37 32
38 // Constructs a PrefHashStoreImpl that calculates hashes using 33 // Constructs a PrefHashStoreImpl that calculates hashes using
39 // |seed| and |device_id| and stores them in |contents|. 34 // |seed| and |device_id| and stores them in |contents|.
40 // 35 //
41 // The same |seed| and |device_id| must be used to load and validate 36 // The same |seed| and |device_id| must be used to load and validate
42 // previously stored hashes in |contents|. 37 // previously stored hashes in |contents|.
43 PrefHashStoreImpl(const std::string& seed, 38 PrefHashStoreImpl(const std::string& seed,
44 const std::string& device_id, 39 const std::string& device_id,
45 scoped_ptr<HashStoreContents> contents,
46 bool use_super_mac); 40 bool use_super_mac);
47 41
48 virtual ~PrefHashStoreImpl(); 42 virtual ~PrefHashStoreImpl();
49 43
44 // Provides an external HashStoreContents implementation to be used.
45 // BeginTransaction() will ignore |storage| if this is provided.
46 void set_legacy_hash_store_contents(
47 scoped_ptr<HashStoreContents> legacy_hash_store_contents);
48
50 // Clears the contents of this PrefHashStore. |IsInitialized()| will return 49 // Clears the contents of this PrefHashStore. |IsInitialized()| will return
51 // false after this call. 50 // false after this call.
52 void Reset(); 51 void Reset();
53 52
54 // PrefHashStore implementation. 53 // PrefHashStore implementation.
55 virtual scoped_ptr<PrefHashStoreTransaction> BeginTransaction() OVERRIDE; 54 virtual scoped_ptr<PrefHashStoreTransaction> BeginTransaction(
56 virtual void CommitPendingWrite() OVERRIDE; 55 scoped_ptr<HashStoreContents> storage) OVERRIDE;
57 56
58 private: 57 private:
59 class PrefHashStoreTransactionImpl; 58 class PrefHashStoreTransactionImpl;
60 59
61 const PrefHashCalculator pref_hash_calculator_; 60 const PrefHashCalculator pref_hash_calculator_;
62 scoped_ptr<HashStoreContents> contents_; 61 scoped_ptr<HashStoreContents> legacy_hash_store_contents_;
63 const bool initial_hashes_dictionary_trusted_;
64 bool use_super_mac_; 62 bool use_super_mac_;
65 63
66 // True if hashes have been modified since the last call to
67 // CommitPendingWriteIfRequired().
68 bool has_pending_write_;
69
70 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl); 64 DISALLOW_COPY_AND_ASSIGN(PrefHashStoreImpl);
71 }; 65 };
72 66
73 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_ 67 #endif // CHROME_BROWSER_PREFS_PREF_HASH_STORE_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_hash_store.h ('k') | chrome/browser/prefs/pref_hash_store_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698