Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / net / quota_policy_channel_id_store.h
bloba2966f8eb3d440164222b5a75940a55a6e433669
1 // Copyright 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.
5 #ifndef CHROME_BROWSER_NET_QUOTA_POLICY_CHANNEL_ID_STORE_H_
6 #define CHROME_BROWSER_NET_QUOTA_POLICY_CHANNEL_ID_STORE_H_
8 #include <set>
9 #include <string>
11 #include "base/callback_forward.h"
12 #include "base/compiler_specific.h"
13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/scoped_vector.h"
17 #include "net/extras/sqlite/sqlite_channel_id_store.h"
18 #include "net/ssl/default_channel_id_store.h"
20 namespace base {
21 class FilePath;
22 class SequencedTaskRunner;
25 namespace storage {
26 class SpecialStoragePolicy;
29 // Persistent ChannelID Store that takes into account SpecialStoragePolicy and
30 // removes ChannelIDs that are StorageSessionOnly when store is closed.
31 class QuotaPolicyChannelIDStore
32 : public net::DefaultChannelIDStore::PersistentStore {
33 public:
34 // Create or open persistent store in file |path|. All I/O tasks are performed
35 // in background using |background_task_runner|. If provided, a
36 // |special_storage_policy| is consulted when the store is closed to decide
37 // which certificates to keep.
38 QuotaPolicyChannelIDStore(
39 const base::FilePath& path,
40 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
41 const scoped_refptr<storage::SpecialStoragePolicy>&
42 special_storage_policy);
44 // net::DefaultChannelIDStore::PersistentStore:
45 void Load(const LoadedCallback& loaded_callback) override;
46 void AddChannelID(
47 const net::DefaultChannelIDStore::ChannelID& channel_id) override;
48 void DeleteChannelID(
49 const net::DefaultChannelIDStore::ChannelID& channel_id) override;
50 void SetForceKeepSessionState() override;
52 private:
53 typedef ScopedVector<net::DefaultChannelIDStore::ChannelID> ChannelIDVector;
55 ~QuotaPolicyChannelIDStore() override;
57 void OnLoad(const LoadedCallback& loaded_callback,
58 scoped_ptr<ChannelIDVector> channel_ids);
60 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
61 scoped_refptr<net::SQLiteChannelIDStore> persistent_store_;
62 // Cache of server identifiers we have channel IDs stored for.
63 std::set<std::string> server_identifiers_;
65 DISALLOW_COPY_AND_ASSIGN(QuotaPolicyChannelIDStore);
68 #endif // CHROME_BROWSER_NET_QUOTA_POLICY_CHANNEL_ID_STORE_H_