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

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

Issue 1703413002: Move common PVer4 code into a V4ProtocolManagerUtil class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass config as pointer, instead of reference Created 4 years, 10 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
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | components/components_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if (resource_request_detector_) 395 if (resource_request_detector_)
396 resource_request_detector_->OnResourceRequest(request); 396 resource_request_detector_->OnResourceRequest(request);
397 #endif 397 #endif
398 } 398 }
399 399
400 SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() { 400 SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() {
401 return new SafeBrowsingUIManager(this); 401 return new SafeBrowsingUIManager(this);
402 } 402 }
403 403
404 SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() { 404 SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() {
405 V4GetHashProtocolConfig config = GetV4GetHashProtocolConfig(); 405 V4ProtocolConfig config = GetV4ProtocolConfig();
406 #if defined(SAFE_BROWSING_DB_LOCAL) 406 #if defined(SAFE_BROWSING_DB_LOCAL)
407 return new LocalSafeBrowsingDatabaseManager(this, NULL, config); 407 return new LocalSafeBrowsingDatabaseManager(this, NULL, config);
408 #elif defined(SAFE_BROWSING_DB_REMOTE) 408 #elif defined(SAFE_BROWSING_DB_REMOTE)
409 return new RemoteSafeBrowsingDatabaseManager(NULL, config); 409 return new RemoteSafeBrowsingDatabaseManager(NULL, config);
410 #else 410 #else
411 return NULL; 411 return NULL;
412 #endif 412 #endif
413 } 413 }
414 414
415 #if defined(FULL_SAFE_BROWSING) 415 #if defined(FULL_SAFE_BROWSING)
(...skipping 23 matching lines...) Expand all
439 cmdline->HasSwitch(switches::kSbDisableAutoUpdate) || 439 cmdline->HasSwitch(switches::kSbDisableAutoUpdate) ||
440 cmdline->HasSwitch(switches::kDisableBackgroundNetworking); 440 cmdline->HasSwitch(switches::kDisableBackgroundNetworking);
441 config.url_prefix = kSbDefaultURLPrefix; 441 config.url_prefix = kSbDefaultURLPrefix;
442 config.backup_connect_error_url_prefix = kSbBackupConnectErrorURLPrefix; 442 config.backup_connect_error_url_prefix = kSbBackupConnectErrorURLPrefix;
443 config.backup_http_error_url_prefix = kSbBackupHttpErrorURLPrefix; 443 config.backup_http_error_url_prefix = kSbBackupHttpErrorURLPrefix;
444 config.backup_network_error_url_prefix = kSbBackupNetworkErrorURLPrefix; 444 config.backup_network_error_url_prefix = kSbBackupNetworkErrorURLPrefix;
445 445
446 return config; 446 return config;
447 } 447 }
448 448
449 V4GetHashProtocolConfig 449 V4ProtocolConfig
450 SafeBrowsingService::GetV4GetHashProtocolConfig() const { 450 SafeBrowsingService::GetV4ProtocolConfig() const {
451 V4GetHashProtocolConfig config; 451 V4ProtocolConfig config;
452 config.client_name = GetProtocolConfigClientName(); 452 config.client_name = GetProtocolConfigClientName();
453 config.version = SafeBrowsingProtocolManagerHelper::Version(); 453 config.version = SafeBrowsingProtocolManagerHelper::Version();
454 config.key_param = google_apis::GetAPIKey();; 454 config.key_param = google_apis::GetAPIKey();;
455 455
456 return config; 456 return config;
457 } 457 }
458 458
459 std::string SafeBrowsingService::GetProtocolConfigClientName() const { 459 std::string SafeBrowsingService::GetProtocolConfigClientName() const {
460 std::string client_name; 460 std::string client_name;
461 // On Windows, get the safe browsing client name from the browser 461 // On Windows, get the safe browsing client name from the browser
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 } 667 }
668 668
669 void SafeBrowsingService::OnSendDownloadRecoveryReport( 669 void SafeBrowsingService::OnSendDownloadRecoveryReport(
670 const std::string& report) { 670 const std::string& report) {
671 DCHECK_CURRENTLY_ON(BrowserThread::IO); 671 DCHECK_CURRENTLY_ON(BrowserThread::IO);
672 if (ping_manager()) 672 if (ping_manager())
673 ping_manager()->ReportThreatDetails(report); 673 ping_manager()->ReportThreatDetails(report);
674 } 674 }
675 675
676 } // namespace safe_browsing 676 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_service.h ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698