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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service.cc

Issue 2874973002: Flush Channel IDs when Cookies get saved to a persistent backend (Closed)
Patch Set: Initialize channel_id_service to nullptr Created 3 years, 7 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
OLDNEW
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 if (shut_down_) 178 if (shut_down_)
179 return nullptr; 179 return nullptr;
180 180
181 if (!safe_browsing_request_context_) { 181 if (!safe_browsing_request_context_) {
182 safe_browsing_request_context_.reset(new net::URLRequestContext()); 182 safe_browsing_request_context_.reset(new net::URLRequestContext());
183 // May be NULL in unit tests. 183 // May be NULL in unit tests.
184 if (system_context_getter_) { 184 if (system_context_getter_) {
185 safe_browsing_request_context_->CopyFrom( 185 safe_browsing_request_context_->CopyFrom(
186 system_context_getter_->GetURLRequestContext()); 186 system_context_getter_->GetURLRequestContext());
187 } 187 }
188 safe_browsing_cookie_store_ = 188 scoped_refptr<base::SequencedTaskRunner> background_task_runner =
189 content::CreateCookieStore(content::CookieStoreConfig( 189 base::CreateSequencedTaskRunnerWithTraits(
190 CookieFilePath(), 190 {base::MayBlock(), base::TaskPriority::BACKGROUND,
191 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, nullptr, 191 base::TaskShutdownBehavior::BLOCK_SHUTDOWN});
192 nullptr)); 192 // Set up the ChannelIDService
193 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db =
194 new net::SQLiteChannelIDStore(ChannelIDFilePath(),
195 background_task_runner);
196 channel_id_service_.reset(new net::ChannelIDService(
197 new net::DefaultChannelIDStore(channel_id_db.get())));
193 198
199 // Set up the CookieStore
200 content::CookieStoreConfig cookie_config(
201 CookieFilePath(), content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
202 nullptr, nullptr);
203 cookie_config.channel_id_service = channel_id_service_.get();
204 cookie_config.background_task_runner = background_task_runner;
205 safe_browsing_cookie_store_ = content::CreateCookieStore(cookie_config);
194 safe_browsing_request_context_->set_cookie_store( 206 safe_browsing_request_context_->set_cookie_store(
195 safe_browsing_cookie_store_.get()); 207 safe_browsing_cookie_store_.get());
196 208
197 // Set up the ChannelIDService
198 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db =
199 new net::SQLiteChannelIDStore(
200 ChannelIDFilePath(),
201 base::CreateSequencedTaskRunnerWithTraits(
202 {base::MayBlock(), base::TaskPriority::BACKGROUND}));
203 channel_id_service_.reset(new net::ChannelIDService(
204 new net::DefaultChannelIDStore(channel_id_db.get())));
205 safe_browsing_request_context_->set_channel_id_service( 209 safe_browsing_request_context_->set_channel_id_service(
206 channel_id_service_.get()); 210 channel_id_service_.get());
207 safe_browsing_cookie_store_->SetChannelIDServiceID( 211 safe_browsing_cookie_store_->SetChannelIDServiceID(
208 channel_id_service_->GetUniqueID()); 212 channel_id_service_->GetUniqueID());
209 213
210 // Rebuild the HttpNetworkSession and the HttpTransactionFactory to use the 214 // Rebuild the HttpNetworkSession and the HttpTransactionFactory to use the
211 // new ChannelIDService. 215 // new ChannelIDService.
212 if (safe_browsing_request_context_->http_transaction_factory() && 216 if (safe_browsing_request_context_->http_transaction_factory() &&
213 safe_browsing_request_context_->http_transaction_factory() 217 safe_browsing_request_context_->http_transaction_factory()
214 ->GetSession()) { 218 ->GetSession()) {
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 auto it = password_protection_service_map_.find(profile); 788 auto it = password_protection_service_map_.find(profile);
785 if (it != password_protection_service_map_.end()) 789 if (it != password_protection_service_map_.end())
786 password_protection_service_map_.erase(it); 790 password_protection_service_map_.erase(it);
787 } 791 }
788 792
789 void SafeBrowsingService::CreateTriggerManager() { 793 void SafeBrowsingService::CreateTriggerManager() {
790 DCHECK_CURRENTLY_ON(BrowserThread::UI); 794 DCHECK_CURRENTLY_ON(BrowserThread::UI);
791 trigger_manager_ = base::MakeUnique<TriggerManager>(ui_manager_.get()); 795 trigger_manager_ = base::MakeUnique<TriggerManager>(ui_manager_.get());
792 } 796 }
793 } // namespace safe_browsing 797 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.cc ('k') | content/browser/net/quota_policy_cookie_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698