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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_channel_id_helper.h

Issue 356713005: Rename ServerBoundCert => ChannelID to reflect the current name (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 months 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_CHANNEL_ID_HELPER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_CHANNEL_ID_HELPER_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/callback.h"
12 #include "net/ssl/channel_id_store.h"
13
14 class Profile;
15
16 // BrowsingDataChannelIDHelper is an interface for classes dealing with
17 // aggregating and deleting browsing data stored in the server bound cert store.
wtc 2014/07/01 19:50:47 You can search for "cert" in this file and fix all
Ryan Hamilton 2014/07/21 19:12:03 Done.
18 // A client of this class need to call StartFetching from the UI thread to
19 // initiate the flow, and it'll be notified by the callback in its UI thread at
20 // some later point.
21 class BrowsingDataChannelIDHelper
22 : public base::RefCountedThreadSafe<BrowsingDataChannelIDHelper> {
23 public:
24
25 // Create a BrowsingDataChannelIDHelper instance for the given
26 // |profile|.
27 static BrowsingDataChannelIDHelper* Create(Profile* profile);
28
29 typedef base::Callback<
30 void(const net::ChannelIDStore::ChannelIDList&)>
31 FetchResultCallback;
32
33 // Starts the fetching process, which will notify its completion via
34 // callback.
35 // This must be called only in the UI thread.
36 virtual void StartFetching(const FetchResultCallback& callback) = 0;
37 // Requests a single server bound cert to be deleted. This must be called in
38 // the UI thread.
39 virtual void DeleteChannelID(const std::string& server_id) = 0;
40
41 protected:
42 friend class base::RefCountedThreadSafe<BrowsingDataChannelIDHelper>;
43 virtual ~BrowsingDataChannelIDHelper() {}
44 };
45
46 // This class is a thin wrapper around BrowsingDataChannelIDHelper that
47 // does not fetch its information from the ChannelIDService, but gets them
48 // passed as a parameter during construction.
49 class CannedBrowsingDataChannelIDHelper
50 : public BrowsingDataChannelIDHelper {
51 public:
52 CannedBrowsingDataChannelIDHelper();
53
54 // Return a copy of the ChannelID helper. Only one consumer can use the
55 // StartFetching method at a time, so we need to create a copy of the helper
56 // every time we instantiate a cookies tree model for it.
57 CannedBrowsingDataChannelIDHelper* Clone();
58
59 // Add an ChannelID to the set of canned server bound certs that is
60 // returned by this helper.
61 void AddChannelID(
62 const net::ChannelIDStore::ChannelID& channel_id);
63
64 // Clears the list of canned server bound certs.
65 void Reset();
66
67 // True if no ChannelIDs are currently stored.
68 bool empty() const;
69
70 // Returns the current number of server bound certificates.
71 size_t GetCertCount() const;
wtc 2014/07/01 19:50:47 GetCertCount => GetChannelIDCount
Ryan Hamilton 2014/07/21 19:12:03 Done.
72
73 // BrowsingDataChannelIDHelper methods.
74 virtual void StartFetching(const FetchResultCallback& callback) OVERRIDE;
75 virtual void DeleteChannelID(const std::string& server_id) OVERRIDE;
76
77 private:
78 virtual ~CannedBrowsingDataChannelIDHelper();
79
80 void FinishFetching();
81
82 typedef std::map<std::string, net::ChannelIDStore::ChannelID>
83 ChannelIDMap;
84 ChannelIDMap channel_id_map_;
85
86 FetchResultCallback completion_callback_;
87
88 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataChannelIDHelper);
89 };
90
91 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_CHANNEL_ID_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698