| 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 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
| 21 #include "base/threading/sequenced_worker_pool.h" | 21 #include "base/task_scheduler/post_task.h" |
| 22 #include "base/threading/thread.h" | 22 #include "base/threading/thread.h" |
| 23 #include "base/threading/thread_restrictions.h" | 23 #include "base/threading/thread_restrictions.h" |
| 24 #include "base/trace_event/trace_event.h" | 24 #include "base/trace_event/trace_event.h" |
| 25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 27 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
| 28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
| 29 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
| 30 #include "chrome/browser/safe_browsing/chrome_password_protection_service.h" | 30 #include "chrome/browser/safe_browsing/chrome_password_protection_service.h" |
| 31 #include "chrome/browser/safe_browsing/ping_manager.h" | 31 #include "chrome/browser/safe_browsing/ping_manager.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 CookieFilePath(), | 188 CookieFilePath(), |
| 189 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, nullptr, | 189 content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, nullptr, |
| 190 nullptr)); | 190 nullptr)); |
| 191 | 191 |
| 192 safe_browsing_request_context_->set_cookie_store( | 192 safe_browsing_request_context_->set_cookie_store( |
| 193 safe_browsing_cookie_store_.get()); | 193 safe_browsing_cookie_store_.get()); |
| 194 | 194 |
| 195 // Set up the ChannelIDService | 195 // Set up the ChannelIDService |
| 196 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db = | 196 scoped_refptr<net::SQLiteChannelIDStore> channel_id_db = |
| 197 new net::SQLiteChannelIDStore( | 197 new net::SQLiteChannelIDStore( |
| 198 ChannelIDFilePath(), | 198 ChannelIDFilePath(), base::CreateSequencedTaskRunnerWithTraits( |
| 199 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( | 199 base::TaskTraits().MayBlock().WithPriority( |
| 200 base::SequencedWorkerPool::GetSequenceToken())); | 200 base::TaskPriority::BACKGROUND))); |
| 201 channel_id_service_.reset(new net::ChannelIDService( | 201 channel_id_service_.reset(new net::ChannelIDService( |
| 202 new net::DefaultChannelIDStore(channel_id_db.get()))); | 202 new net::DefaultChannelIDStore(channel_id_db.get()))); |
| 203 safe_browsing_request_context_->set_channel_id_service( | 203 safe_browsing_request_context_->set_channel_id_service( |
| 204 channel_id_service_.get()); | 204 channel_id_service_.get()); |
| 205 safe_browsing_cookie_store_->SetChannelIDServiceID( | 205 safe_browsing_cookie_store_->SetChannelIDServiceID( |
| 206 channel_id_service_->GetUniqueID()); | 206 channel_id_service_->GetUniqueID()); |
| 207 | 207 |
| 208 // Rebuild the HttpNetworkSession and the HttpTransactionFactory to use the | 208 // Rebuild the HttpNetworkSession and the HttpTransactionFactory to use the |
| 209 // new ChannelIDService. | 209 // new ChannelIDService. |
| 210 if (safe_browsing_request_context_->http_transaction_factory() && | 210 if (safe_browsing_request_context_->http_transaction_factory() && |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 | 773 |
| 774 void SafeBrowsingService::RemovePasswordProtectionService(Profile* profile) { | 774 void SafeBrowsingService::RemovePasswordProtectionService(Profile* profile) { |
| 775 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 775 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 776 DCHECK(profile); | 776 DCHECK(profile); |
| 777 auto it = password_protection_service_map_.find(profile); | 777 auto it = password_protection_service_map_.find(profile); |
| 778 if (it != password_protection_service_map_.end()) | 778 if (it != password_protection_service_map_.end()) |
| 779 password_protection_service_map_.erase(it); | 779 password_protection_service_map_.erase(it); |
| 780 } | 780 } |
| 781 | 781 |
| 782 } // namespace safe_browsing | 782 } // namespace safe_browsing |
| OLD | NEW |