OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "chrome/browser/profiles/profile.h" | |
12 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
13 #include "net/ssl/channel_id_service.h" | 12 #include "net/ssl/channel_id_service.h" |
14 #include "net/url_request/url_request_context.h" | 13 #include "net/url_request/url_request_context.h" |
15 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
16 | 15 |
17 using content::BrowserThread; | 16 using content::BrowserThread; |
18 | 17 |
19 namespace { | 18 namespace { |
20 | 19 |
21 class BrowsingDataChannelIDHelperImpl | 20 class BrowsingDataChannelIDHelperImpl |
22 : public BrowsingDataChannelIDHelper { | 21 : public BrowsingDataChannelIDHelper { |
23 public: | 22 public: |
24 explicit BrowsingDataChannelIDHelperImpl(Profile* profile); | 23 explicit BrowsingDataChannelIDHelperImpl( |
| 24 net::URLRequestContextGetter* request_context); |
25 | 25 |
26 // BrowsingDataChannelIDHelper methods. | 26 // BrowsingDataChannelIDHelper methods. |
27 virtual void StartFetching(const FetchResultCallback& callback) OVERRIDE; | 27 virtual void StartFetching(const FetchResultCallback& callback) OVERRIDE; |
28 virtual void DeleteChannelID(const std::string& server_id) OVERRIDE; | 28 virtual void DeleteChannelID(const std::string& server_id) OVERRIDE; |
29 | 29 |
30 private: | 30 private: |
31 virtual ~BrowsingDataChannelIDHelperImpl(); | 31 virtual ~BrowsingDataChannelIDHelperImpl(); |
32 | 32 |
33 // Fetch the certs. This must be called in the IO thread. | 33 // Fetch the certs. This must be called in the IO thread. |
34 void FetchOnIOThread(); | 34 void FetchOnIOThread(); |
(...skipping 18 matching lines...) Expand all Loading... |
53 bool is_fetching_; | 53 bool is_fetching_; |
54 | 54 |
55 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 55 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
56 | 56 |
57 // This member is only mutated on the UI thread. | 57 // This member is only mutated on the UI thread. |
58 FetchResultCallback completion_callback_; | 58 FetchResultCallback completion_callback_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(BrowsingDataChannelIDHelperImpl); | 60 DISALLOW_COPY_AND_ASSIGN(BrowsingDataChannelIDHelperImpl); |
61 }; | 61 }; |
62 | 62 |
63 BrowsingDataChannelIDHelperImpl:: | 63 BrowsingDataChannelIDHelperImpl::BrowsingDataChannelIDHelperImpl( |
64 BrowsingDataChannelIDHelperImpl(Profile* profile) | 64 net::URLRequestContextGetter* request_context) |
65 : is_fetching_(false), | 65 : is_fetching_(false), request_context_getter_(request_context) { |
66 request_context_getter_(profile->GetRequestContext()) { | |
67 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 66 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
68 } | 67 } |
69 | 68 |
70 BrowsingDataChannelIDHelperImpl:: | 69 BrowsingDataChannelIDHelperImpl:: |
71 ~BrowsingDataChannelIDHelperImpl() { | 70 ~BrowsingDataChannelIDHelperImpl() { |
72 } | 71 } |
73 | 72 |
74 void BrowsingDataChannelIDHelperImpl::StartFetching( | 73 void BrowsingDataChannelIDHelperImpl::StartFetching( |
75 const FetchResultCallback& callback) { | 74 const FetchResultCallback& callback) { |
76 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 75 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // are deleting. | 147 // are deleting. |
149 // TODO(mattm): http://crbug.com/166069 Make the server bound cert | 148 // TODO(mattm): http://crbug.com/166069 Make the server bound cert |
150 // service/store have observers that can notify relevant things directly. | 149 // service/store have observers that can notify relevant things directly. |
151 request_context_getter_->GetURLRequestContext()->ssl_config_service()-> | 150 request_context_getter_->GetURLRequestContext()->ssl_config_service()-> |
152 NotifySSLConfigChange(); | 151 NotifySSLConfigChange(); |
153 } | 152 } |
154 | 153 |
155 } // namespace | 154 } // namespace |
156 | 155 |
157 // static | 156 // static |
158 BrowsingDataChannelIDHelper* | 157 BrowsingDataChannelIDHelper* BrowsingDataChannelIDHelper::Create( |
159 BrowsingDataChannelIDHelper::Create(Profile* profile) { | 158 net::URLRequestContextGetter* request_context) { |
160 return new BrowsingDataChannelIDHelperImpl(profile); | 159 return new BrowsingDataChannelIDHelperImpl(request_context); |
161 } | 160 } |
162 | 161 |
163 CannedBrowsingDataChannelIDHelper:: | 162 CannedBrowsingDataChannelIDHelper:: |
164 CannedBrowsingDataChannelIDHelper() {} | 163 CannedBrowsingDataChannelIDHelper() {} |
165 | 164 |
166 CannedBrowsingDataChannelIDHelper:: | 165 CannedBrowsingDataChannelIDHelper:: |
167 ~CannedBrowsingDataChannelIDHelper() {} | 166 ~CannedBrowsingDataChannelIDHelper() {} |
168 | 167 |
169 CannedBrowsingDataChannelIDHelper* | 168 CannedBrowsingDataChannelIDHelper* |
170 CannedBrowsingDataChannelIDHelper::Clone() { | 169 CannedBrowsingDataChannelIDHelper::Clone() { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 for (ChannelIDMap::iterator i = channel_id_map_.begin(); | 214 for (ChannelIDMap::iterator i = channel_id_map_.begin(); |
216 i != channel_id_map_.end(); ++i) | 215 i != channel_id_map_.end(); ++i) |
217 channel_id_list.push_back(i->second); | 216 channel_id_list.push_back(i->second); |
218 completion_callback_.Run(channel_id_list); | 217 completion_callback_.Run(channel_id_list); |
219 } | 218 } |
220 | 219 |
221 void CannedBrowsingDataChannelIDHelper::DeleteChannelID( | 220 void CannedBrowsingDataChannelIDHelper::DeleteChannelID( |
222 const std::string& server_id) { | 221 const std::string& server_id) { |
223 NOTREACHED(); | 222 NOTREACHED(); |
224 } | 223 } |
OLD | NEW |