OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // TransportSecurityState maintains an in memory database containing the | 5 // TransportSecurityState maintains an in memory database containing the |
6 // list of hosts that currently have transport security enabled. This | 6 // list of hosts that currently have transport security enabled. This |
7 // singleton object deals with writing that data out to disk as needed and | 7 // singleton object deals with writing that data out to disk as needed and |
8 // loading it at startup. | 8 // loading it at startup. |
9 | 9 |
10 // At startup we need to load the transport security state from the | 10 // At startup we need to load the transport security state from the |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 explicit TransportSecurityPersister(bool readonly); | 46 explicit TransportSecurityPersister(bool readonly); |
47 void Initialize(net::TransportSecurityState* state, | 47 void Initialize(net::TransportSecurityState* state, |
48 const FilePath& profile_path); | 48 const FilePath& profile_path); |
49 | 49 |
50 // Called by the TransportSecurityState when it changes its state. | 50 // Called by the TransportSecurityState when it changes its state. |
51 virtual void StateIsDirty(net::TransportSecurityState*); | 51 virtual void StateIsDirty(net::TransportSecurityState*); |
52 | 52 |
53 private: | 53 private: |
54 friend class base::RefCountedThreadSafe<TransportSecurityPersister>; | 54 friend class base::RefCountedThreadSafe<TransportSecurityPersister>; |
55 | 55 |
56 ~TransportSecurityPersister(); | 56 virtual ~TransportSecurityPersister(); |
57 | 57 |
58 void Load(); | 58 void Load(); |
59 void CompleteLoad(const std::string& state); | 59 void CompleteLoad(const std::string& state); |
60 | 60 |
61 void Save(); | 61 void Save(); |
62 void CompleteSave(const std::string& state); | 62 void CompleteSave(const std::string& state); |
63 | 63 |
64 // Used on the IO thread to coalesce writes to disk. | 64 // Used on the IO thread to coalesce writes to disk. |
65 ScopedRunnableMethodFactory<TransportSecurityPersister> save_coalescer_; | 65 ScopedRunnableMethodFactory<TransportSecurityPersister> save_coalescer_; |
66 | 66 |
67 scoped_refptr<net::TransportSecurityState> | 67 scoped_refptr<net::TransportSecurityState> |
68 transport_security_state_; // IO thread only. | 68 transport_security_state_; // IO thread only. |
69 | 69 |
70 // The path to the file in which we store the serialised state. | 70 // The path to the file in which we store the serialised state. |
71 FilePath state_file_; | 71 FilePath state_file_; |
72 | 72 |
73 // Whether or not we're in read-only mode. | 73 // Whether or not we're in read-only mode. |
74 bool readonly_; | 74 bool readonly_; |
75 }; | 75 }; |
76 | 76 |
77 #endif // CHROME_BROWSER_TRANSPORT_SECURITY_PERSISTER_H_ | 77 #endif // CHROME_BROWSER_TRANSPORT_SECURITY_PERSISTER_H_ |
OLD | NEW |