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

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

Issue 1924983002: Enable V4LocalDatabaseManager based on Finch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git fetch & pull Created 4 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 291
292 void SafeBrowsingService::Initialize() { 292 void SafeBrowsingService::Initialize() {
293 url_request_context_getter_ = new SafeBrowsingURLRequestContextGetter( 293 url_request_context_getter_ = new SafeBrowsingURLRequestContextGetter(
294 g_browser_process->system_request_context()); 294 g_browser_process->system_request_context());
295 295
296 ui_manager_ = CreateUIManager(); 296 ui_manager_ = CreateUIManager();
297 297
298 database_manager_ = CreateDatabaseManager(); 298 database_manager_ = CreateDatabaseManager();
299 299
300 services_delegate_->Initialize();
300 services_delegate_->InitializeCsdService(url_request_context_getter_.get()); 301 services_delegate_->InitializeCsdService(url_request_context_getter_.get());
301 services_delegate_->InitializeServices();
302 302
303 // Track the safe browsing preference of existing profiles. 303 // Track the safe browsing preference of existing profiles.
304 // The SafeBrowsingService will be started if any existing profile has the 304 // The SafeBrowsingService will be started if any existing profile has the
305 // preference enabled. It will also listen for updates to the preferences. 305 // preference enabled. It will also listen for updates to the preferences.
306 ProfileManager* profile_manager = g_browser_process->profile_manager(); 306 ProfileManager* profile_manager = g_browser_process->profile_manager();
307 if (profile_manager) { 307 if (profile_manager) {
308 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles(); 308 std::vector<Profile*> profiles = profile_manager->GetLoadedProfiles();
309 // TODO(felt): I believe this for-loop is dead code. Confirm this and 309 // TODO(felt): I believe this for-loop is dead code. Confirm this and
310 // remove in a future CL. See https://codereview.chromium.org/1341533002/ 310 // remove in a future CL. See https://codereview.chromium.org/1341533002/
311 DCHECK_EQ(0u, profiles.size()); 311 DCHECK_EQ(0u, profiles.size());
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 void SafeBrowsingService::StartOnIOThread( 518 void SafeBrowsingService::StartOnIOThread(
519 net::URLRequestContextGetter* url_request_context_getter) { 519 net::URLRequestContextGetter* url_request_context_getter) {
520 DCHECK_CURRENTLY_ON(BrowserThread::IO); 520 DCHECK_CURRENTLY_ON(BrowserThread::IO);
521 if (enabled_) 521 if (enabled_)
522 return; 522 return;
523 enabled_ = true; 523 enabled_ = true;
524 524
525 SafeBrowsingProtocolConfig config = GetProtocolConfig(); 525 SafeBrowsingProtocolConfig config = GetProtocolConfig();
526 V4ProtocolConfig v4_config = GetV4ProtocolConfig(); 526 V4ProtocolConfig v4_config = GetV4ProtocolConfig();
527 527
528 services_delegate_->StartOnIOThread(url_request_context_getter, v4_config);
529
528 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) 530 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE)
529 DCHECK(database_manager_.get()); 531 DCHECK(database_manager_.get());
530 database_manager_->StartOnIOThread(url_request_context_getter, v4_config); 532 database_manager_->StartOnIOThread(url_request_context_getter, v4_config);
531 #endif 533 #endif
532 534
533 #if defined(SAFE_BROWSING_DB_LOCAL) 535 #if defined(SAFE_BROWSING_DB_LOCAL)
534 SafeBrowsingProtocolManagerDelegate* protocol_manager_delegate = 536 SafeBrowsingProtocolManagerDelegate* protocol_manager_delegate =
535 GetProtocolManagerDelegate(); 537 GetProtocolManagerDelegate();
536 if (protocol_manager_delegate) { 538 if (protocol_manager_delegate) {
537 protocol_manager_ = SafeBrowsingProtocolManager::Create( 539 protocol_manager_ = SafeBrowsingProtocolManager::Create(
538 protocol_manager_delegate, url_request_context_getter, config); 540 protocol_manager_delegate, url_request_context_getter, config);
539 protocol_manager_->Initialize(); 541 protocol_manager_->Initialize();
540 } 542 }
541 #endif 543 #endif
542 544
543 DCHECK(!ping_manager_); 545 DCHECK(!ping_manager_);
544 ping_manager_ = SafeBrowsingPingManager::Create( 546 ping_manager_ = SafeBrowsingPingManager::Create(
545 url_request_context_getter, config); 547 url_request_context_getter, config);
546 } 548 }
547 549
548 void SafeBrowsingService::StopOnIOThread(bool shutdown) { 550 void SafeBrowsingService::StopOnIOThread(bool shutdown) {
549 DCHECK_CURRENTLY_ON(BrowserThread::IO); 551 DCHECK_CURRENTLY_ON(BrowserThread::IO);
550 552
553 services_delegate_->StopOnIOThread(shutdown);
Nathan Parker 2016/04/30 00:22:29 Should we do this in inverse order? If it's start
vakh (use Gerrit instead) 2016/04/30 00:51:50 Done.
554
551 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) 555 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE)
552 database_manager_->StopOnIOThread(shutdown); 556 database_manager_->StopOnIOThread(shutdown);
553 #endif 557 #endif
554 ui_manager_->StopOnIOThread(shutdown); 558 ui_manager_->StopOnIOThread(shutdown);
555 559
556 if (enabled_) { 560 if (enabled_) {
557 enabled_ = false; 561 enabled_ = false;
558 562
559 #if defined(SAFE_BROWSING_DB_LOCAL) 563 #if defined(SAFE_BROWSING_DB_LOCAL)
560 // This cancels all in-flight GetHash requests. Note that 564 // This cancels all in-flight GetHash requests. Note that
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 ping_manager()->ReportThreatDetails(report); 690 ping_manager()->ReportThreatDetails(report);
687 } 691 }
688 692
689 void SafeBrowsingService::ProcessResourceRequest( 693 void SafeBrowsingService::ProcessResourceRequest(
690 const ResourceRequestInfo& request) { 694 const ResourceRequestInfo& request) {
691 DCHECK_CURRENTLY_ON(BrowserThread::UI); 695 DCHECK_CURRENTLY_ON(BrowserThread::UI);
692 services_delegate_->ProcessResourceRequest(&request); 696 services_delegate_->ProcessResourceRequest(&request);
693 } 697 }
694 698
695 } // namespace safe_browsing 699 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/services_delegate.h » ('j') | chrome/browser/safe_browsing/services_delegate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698