OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_NET_QUOTA_POLICY_CHANNEL_ID_STORE_H_ |
| 6 #define CONTENT_BROWSER_NET_QUOTA_POLICY_CHANNEL_ID_STORE_H_ |
| 7 |
| 8 #include <set> |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 12 #include "base/callback_forward.h" |
| 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/scoped_vector.h" |
| 17 #include "content/common/content_export.h" |
| 18 #include "net/ssl/default_channel_id_store.h" |
| 19 |
| 20 namespace base { |
| 21 class FilePath; |
| 22 class SequencedTaskRunner; |
| 23 } |
| 24 |
| 25 namespace quota { |
| 26 class SpecialStoragePolicy; |
| 27 } |
| 28 |
| 29 namespace content { |
| 30 |
| 31 // Persistent ChannelID Store that takes into account SpecialStoragePolicy and |
| 32 // removes ChannelIDs that are StorageSessionOnly when store is closed. |
| 33 class CONTENT_EXPORT QuotaPolicyChannelIDStore |
| 34 : public net::DefaultChannelIDStore::PersistentStore { |
| 35 public: |
| 36 // Create or open persistent store in file |path|. All I/O tasks are performed |
| 37 // in background using |background_task_runner|. If provided, a |
| 38 // |special_storage_policy| is consulted when the store is closed to decide |
| 39 // which certificates to keep. |
| 40 QuotaPolicyChannelIDStore( |
| 41 const base::FilePath& path, |
| 42 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, |
| 43 quota::SpecialStoragePolicy* special_storage_policy); |
| 44 |
| 45 // net::DefaultChannelIDStore::PersistentStore: |
| 46 virtual void Load(const LoadedCallback& loaded_callback) OVERRIDE; |
| 47 virtual void AddChannelID( |
| 48 const net::DefaultChannelIDStore::ChannelID& channel_id) OVERRIDE; |
| 49 virtual void DeleteChannelID( |
| 50 const net::DefaultChannelIDStore::ChannelID& channel_id) OVERRIDE; |
| 51 virtual void DeleteAll( |
| 52 const std::vector<std::string>& server_identifiers) OVERRIDE; |
| 53 virtual void SetForceKeepSessionState() OVERRIDE; |
| 54 |
| 55 private: |
| 56 typedef ScopedVector<net::DefaultChannelIDStore::ChannelID> ChannelIDVector; |
| 57 |
| 58 virtual ~QuotaPolicyChannelIDStore(); |
| 59 |
| 60 void OnLoad(const LoadedCallback& loaded_callback, |
| 61 scoped_ptr<ChannelIDVector> channel_ids); |
| 62 |
| 63 // True if everything should go to persistent store. |
| 64 bool force_keep_session_state_; |
| 65 const base::FilePath& path_; |
| 66 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
| 67 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; |
| 68 scoped_refptr<net::DefaultChannelIDStore::PersistentStore> persistent_store_; |
| 69 // Cache of server identifiers we have channel IDs stored for. |
| 70 std::set<std::string> server_identifiers_; |
| 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(QuotaPolicyChannelIDStore); |
| 73 }; |
| 74 |
| 75 } // namespace content |
| 76 |
| 77 #endif // CONTENT_BROWSER_NET_QUOTA_POLICY_CHANNEL_ID_STORE_H_ |
OLD | NEW |