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 class TransportSecurityPersister | 46 class TransportSecurityPersister |
47 : public net::TransportSecurityState::Delegate, | 47 : public net::TransportSecurityState::Delegate, |
48 public ImportantFileWriter::DataSerializer { | 48 public ImportantFileWriter::DataSerializer { |
49 public: | 49 public: |
50 TransportSecurityPersister(net::TransportSecurityState* state, | 50 TransportSecurityPersister(net::TransportSecurityState* state, |
51 const FilePath& profile_path, | 51 const FilePath& profile_path, |
52 bool readonly); | 52 bool readonly); |
53 virtual ~TransportSecurityPersister(); | 53 virtual ~TransportSecurityPersister(); |
54 | 54 |
55 // Called by the TransportSecurityState when it changes its state. | 55 // Called by the TransportSecurityState when it changes its state. |
56 virtual void StateIsDirty(net::TransportSecurityState*); | 56 virtual void StateIsDirty(net::TransportSecurityState*) OVERRIDE; |
57 | 57 |
58 // ImportantFileWriter::DataSerializer: | 58 // ImportantFileWriter::DataSerializer: |
59 virtual bool SerializeData(std::string* data); | 59 virtual bool SerializeData(std::string* data) OVERRIDE; |
60 | 60 |
61 private: | 61 private: |
62 class Loader; | 62 class Loader; |
63 | 63 |
64 void CompleteLoad(const std::string& state); | 64 void CompleteLoad(const std::string& state); |
65 | 65 |
66 net::TransportSecurityState* transport_security_state_; | 66 net::TransportSecurityState* transport_security_state_; |
67 | 67 |
68 // Helper for safely writing the data. | 68 // Helper for safely writing the data. |
69 ImportantFileWriter writer_; | 69 ImportantFileWriter writer_; |
70 | 70 |
71 // Whether or not we're in read-only mode. | 71 // Whether or not we're in read-only mode. |
72 const bool readonly_; | 72 const bool readonly_; |
73 | 73 |
74 base::WeakPtrFactory<TransportSecurityPersister> weak_ptr_factory_; | 74 base::WeakPtrFactory<TransportSecurityPersister> weak_ptr_factory_; |
75 | 75 |
76 DISALLOW_COPY_AND_ASSIGN(TransportSecurityPersister); | 76 DISALLOW_COPY_AND_ASSIGN(TransportSecurityPersister); |
77 }; | 77 }; |
78 | 78 |
79 #endif // CHROME_BROWSER_TRANSPORT_SECURITY_PERSISTER_H_ | 79 #endif // CHROME_BROWSER_TRANSPORT_SECURITY_PERSISTER_H_ |
OLD | NEW |