| 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_ = | 187 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
| 188 content::CreateCookieStore(content::CookieStoreConfig( | 188 base::CreateSequencedTaskRunnerWithTraits( |
| 189 CookieFilePath(), | 189 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
| 190 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, nullptr, | 190 base::TaskShutdownBehavior::BLOCK_SHUTDOWN}); |
| 191 nullptr)); | 191 // Set up the ChannelIDService |
| 192 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db = |
| 193 new net::SQLiteChannelIDStore(ChannelIDFilePath(), |
| 194 background_task_runner); |
| 195 channel_id_service_.reset(new net::ChannelIDService( |
| 196 new net::DefaultChannelIDStore(channel_id_db.get()))); |
| 192 | 197 |
| 198 // Set up the CookieStore |
| 199 content::CookieStoreConfig cookie_config( |
| 200 CookieFilePath(), content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, |
| 201 nullptr, nullptr); |
| 202 cookie_config.channel_id_service = channel_id_service_.get(); |
| 203 cookie_config.background_task_runner = background_task_runner; |
| 204 safe_browsing_cookie_store_ = content::CreateCookieStore(cookie_config); |
| 193 safe_browsing_request_context_->set_cookie_store( | 205 safe_browsing_request_context_->set_cookie_store( |
| 194 safe_browsing_cookie_store_.get()); | 206 safe_browsing_cookie_store_.get()); |
| 195 | 207 |
| 196 // Set up the ChannelIDService | |
| 197 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db = | |
| 198 new net::SQLiteChannelIDStore( | |
| 199 ChannelIDFilePath(), | |
| 200 base::CreateSequencedTaskRunnerWithTraits( | |
| 201 {base::MayBlock(), base::TaskPriority::BACKGROUND})); | |
| 202 channel_id_service_.reset(new net::ChannelIDService( | |
| 203 new net::DefaultChannelIDStore(channel_id_db.get()))); | |
| 204 safe_browsing_request_context_->set_channel_id_service( | 208 safe_browsing_request_context_->set_channel_id_service( |
| 205 channel_id_service_.get()); | 209 channel_id_service_.get()); |
| 206 safe_browsing_cookie_store_->SetChannelIDServiceID( | 210 safe_browsing_cookie_store_->SetChannelIDServiceID( |
| 207 channel_id_service_->GetUniqueID()); | 211 channel_id_service_->GetUniqueID()); |
| 208 | 212 |
| 209 // Rebuild the HttpNetworkSession and the HttpTransactionFactory to use the | 213 // Rebuild the HttpNetworkSession and the HttpTransactionFactory to use the |
| 210 // new ChannelIDService. | 214 // new ChannelIDService. |
| 211 if (safe_browsing_request_context_->http_transaction_factory() && | 215 if (safe_browsing_request_context_->http_transaction_factory() && |
| 212 safe_browsing_request_context_->http_transaction_factory() | 216 safe_browsing_request_context_->http_transaction_factory() |
| 213 ->GetSession()) { | 217 ->GetSession()) { |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 auto it = password_protection_service_map_.find(profile); | 787 auto it = password_protection_service_map_.find(profile); |
| 784 if (it != password_protection_service_map_.end()) | 788 if (it != password_protection_service_map_.end()) |
| 785 password_protection_service_map_.erase(it); | 789 password_protection_service_map_.erase(it); |
| 786 } | 790 } |
| 787 | 791 |
| 788 void SafeBrowsingService::CreateTriggerManager() { | 792 void SafeBrowsingService::CreateTriggerManager() { |
| 789 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 793 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 790 trigger_manager_ = base::MakeUnique<TriggerManager>(ui_manager_.get()); | 794 trigger_manager_ = base::MakeUnique<TriggerManager>(ui_manager_.get()); |
| 791 } | 795 } |
| 792 } // namespace safe_browsing | 796 } // namespace safe_browsing |
| OLD | NEW |