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

Side by Side Diff: chrome/browser/net/transport_security_persister.h

Issue 11227026: Move ImportantFileWriter to base/. It now has two consumers, base/prefs and chrome/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win build for real. Created 8 years, 1 month 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/bookmarks/bookmark_storage.h ('k') | chrome/chrome_common.gypi » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 18 matching lines...) Expand all
29 // TransportSecurityPersister::SerializeState 29 // TransportSecurityPersister::SerializeState
30 // copies the current state of the TransportSecurityState, serializes 30 // copies the current state of the TransportSecurityState, serializes
31 // and writes to disk. 31 // and writes to disk.
32 32
33 #ifndef CHROME_BROWSER_NET_TRANSPORT_SECURITY_PERSISTER_H_ 33 #ifndef CHROME_BROWSER_NET_TRANSPORT_SECURITY_PERSISTER_H_
34 #define CHROME_BROWSER_NET_TRANSPORT_SECURITY_PERSISTER_H_ 34 #define CHROME_BROWSER_NET_TRANSPORT_SECURITY_PERSISTER_H_
35 35
36 #include <string> 36 #include <string>
37 37
38 #include "base/file_path.h" 38 #include "base/file_path.h"
39 #include "base/files/important_file_writer.h"
39 #include "base/memory/weak_ptr.h" 40 #include "base/memory/weak_ptr.h"
40 #include "chrome/common/important_file_writer.h"
41 #include "net/base/transport_security_state.h" 41 #include "net/base/transport_security_state.h"
42 42
43 // Reads and updates on-disk TransportSecurity state. 43 // Reads and updates on-disk TransportSecurity state.
44 // Must be created, used and destroyed only on the IO thread. 44 // Must be created, used and destroyed only on the IO thread.
45 class TransportSecurityPersister 45 class TransportSecurityPersister
46 : public net::TransportSecurityState::Delegate, 46 : public net::TransportSecurityState::Delegate,
47 public ImportantFileWriter::DataSerializer { 47 public base::ImportantFileWriter::DataSerializer {
48 public: 48 public:
49 TransportSecurityPersister(net::TransportSecurityState* state, 49 TransportSecurityPersister(net::TransportSecurityState* state,
50 const FilePath& profile_path, 50 const FilePath& profile_path,
51 bool readonly); 51 bool readonly);
52 virtual ~TransportSecurityPersister(); 52 virtual ~TransportSecurityPersister();
53 53
54 // Called by the TransportSecurityState when it changes its state. 54 // Called by the TransportSecurityState when it changes its state.
55 virtual void StateIsDirty(net::TransportSecurityState*) OVERRIDE; 55 virtual void StateIsDirty(net::TransportSecurityState*) OVERRIDE;
56 56
57 // ImportantFileWriter::DataSerializer: 57 // ImportantFileWriter::DataSerializer:
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 static bool Deserialize(const std::string& serialized, 110 static bool Deserialize(const std::string& serialized,
111 bool forced, 111 bool forced,
112 bool* dirty, 112 bool* dirty,
113 net::TransportSecurityState* state); 113 net::TransportSecurityState* state);
114 114
115 void CompleteLoad(const std::string& state); 115 void CompleteLoad(const std::string& state);
116 116
117 net::TransportSecurityState* transport_security_state_; 117 net::TransportSecurityState* transport_security_state_;
118 118
119 // Helper for safely writing the data. 119 // Helper for safely writing the data.
120 ImportantFileWriter writer_; 120 base::ImportantFileWriter writer_;
121 121
122 // Whether or not we're in read-only mode. 122 // Whether or not we're in read-only mode.
123 const bool readonly_; 123 const bool readonly_;
124 124
125 base::WeakPtrFactory<TransportSecurityPersister> weak_ptr_factory_; 125 base::WeakPtrFactory<TransportSecurityPersister> weak_ptr_factory_;
126 126
127 DISALLOW_COPY_AND_ASSIGN(TransportSecurityPersister); 127 DISALLOW_COPY_AND_ASSIGN(TransportSecurityPersister);
128 }; 128 };
129 129
130 #endif // CHROME_BROWSER_NET_TRANSPORT_SECURITY_PERSISTER_H_ 130 #endif // CHROME_BROWSER_NET_TRANSPORT_SECURITY_PERSISTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_storage.h ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698