OLD | NEW |
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 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (shut_down_) | 177 if (shut_down_) |
178 return nullptr; | 178 return nullptr; |
179 | 179 |
180 if (!safe_browsing_request_context_) { | 180 if (!safe_browsing_request_context_) { |
181 safe_browsing_request_context_.reset(new net::URLRequestContext()); | 181 safe_browsing_request_context_.reset(new net::URLRequestContext()); |
182 // May be NULL in unit tests. | 182 // May be NULL in unit tests. |
183 if (system_context_getter_) { | 183 if (system_context_getter_) { |
184 safe_browsing_request_context_->CopyFrom( | 184 safe_browsing_request_context_->CopyFrom( |
185 system_context_getter_->GetURLRequestContext()); | 185 system_context_getter_->GetURLRequestContext()); |
186 } | 186 } |
187 safe_browsing_cookie_store_ = | |
188 content::CreateCookieStore(content::CookieStoreConfig( | |
189 CookieFilePath(), | |
190 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, nullptr, | |
191 nullptr)); | |
192 | |
193 safe_browsing_request_context_->set_cookie_store( | |
194 safe_browsing_cookie_store_.get()); | |
195 | |
196 // Set up the ChannelIDService | 187 // Set up the ChannelIDService |
197 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db = | 188 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db = |
198 new net::SQLiteChannelIDStore( | 189 new net::SQLiteChannelIDStore( |
199 ChannelIDFilePath(), | 190 ChannelIDFilePath(), |
200 base::CreateSequencedTaskRunnerWithTraits( | 191 base::CreateSequencedTaskRunnerWithTraits( |
201 {base::MayBlock(), base::TaskPriority::BACKGROUND})); | 192 {base::MayBlock(), base::TaskPriority::BACKGROUND})); |
202 channel_id_service_.reset(new net::ChannelIDService( | 193 channel_id_service_.reset(new net::ChannelIDService( |
203 new net::DefaultChannelIDStore(channel_id_db.get()))); | 194 new net::DefaultChannelIDStore(channel_id_db.get()))); |
| 195 |
| 196 // Set up the CookieStore |
| 197 content::CookieStoreConfig cookie_config( |
| 198 CookieFilePath(), content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, |
| 199 nullptr, nullptr); |
| 200 cookie_config.channel_id_service = channel_id_service_.get(); |
| 201 safe_browsing_cookie_store_ = content::CreateCookieStore(cookie_config); |
| 202 safe_browsing_request_context_->set_cookie_store( |
| 203 safe_browsing_cookie_store_.get()); |
| 204 |
204 safe_browsing_request_context_->set_channel_id_service( | 205 safe_browsing_request_context_->set_channel_id_service( |
205 channel_id_service_.get()); | 206 channel_id_service_.get()); |
206 safe_browsing_cookie_store_->SetChannelIDServiceID( | 207 safe_browsing_cookie_store_->SetChannelIDServiceID( |
207 channel_id_service_->GetUniqueID()); | 208 channel_id_service_->GetUniqueID()); |
208 | 209 |
209 // Rebuild the HttpNetworkSession and the HttpTransactionFactory to use the | 210 // Rebuild the HttpNetworkSession and the HttpTransactionFactory to use the |
210 // new ChannelIDService. | 211 // new ChannelIDService. |
211 if (safe_browsing_request_context_->http_transaction_factory() && | 212 if (safe_browsing_request_context_->http_transaction_factory() && |
212 safe_browsing_request_context_->http_transaction_factory() | 213 safe_browsing_request_context_->http_transaction_factory() |
213 ->GetSession()) { | 214 ->GetSession()) { |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 auto it = password_protection_service_map_.find(profile); | 784 auto it = password_protection_service_map_.find(profile); |
784 if (it != password_protection_service_map_.end()) | 785 if (it != password_protection_service_map_.end()) |
785 password_protection_service_map_.erase(it); | 786 password_protection_service_map_.erase(it); |
786 } | 787 } |
787 | 788 |
788 void SafeBrowsingService::CreateTriggerManager() { | 789 void SafeBrowsingService::CreateTriggerManager() { |
789 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 790 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
790 trigger_manager_ = base::MakeUnique<TriggerManager>(ui_manager_.get()); | 791 trigger_manager_ = base::MakeUnique<TriggerManager>(ui_manager_.get()); |
791 } | 792 } |
792 } // namespace safe_browsing | 793 } // namespace safe_browsing |
OLD | NEW |