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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 database_manager_ = CreateDatabaseManager(); | 212 database_manager_ = CreateDatabaseManager(); |
213 | 213 |
214 BrowserThread::PostTask( | 214 BrowserThread::PostTask( |
215 BrowserThread::IO, FROM_HERE, | 215 BrowserThread::IO, FROM_HERE, |
216 base::Bind( | 216 base::Bind( |
217 &SafeBrowsingService::InitURLRequestContextOnIOThread, this, | 217 &SafeBrowsingService::InitURLRequestContextOnIOThread, this, |
218 make_scoped_refptr(g_browser_process->system_request_context()))); | 218 make_scoped_refptr(g_browser_process->system_request_context()))); |
219 | 219 |
220 #if defined(FULL_SAFE_BROWSING) | 220 #if defined(FULL_SAFE_BROWSING) |
221 #if !defined(OS_ANDROID) | 221 #if !defined(OS_ANDROID) |
222 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 222 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
223 switches::kDisableClientSidePhishingDetection)) { | 223 switches::kDisableClientSidePhishingDetection)) { |
224 csd_service_.reset(safe_browsing::ClientSideDetectionService::Create( | 224 csd_service_.reset(safe_browsing::ClientSideDetectionService::Create( |
225 url_request_context_getter_.get())); | 225 url_request_context_getter_.get())); |
226 } | 226 } |
227 download_service_.reset(new safe_browsing::DownloadProtectionService( | 227 download_service_.reset(new safe_browsing::DownloadProtectionService( |
228 this, url_request_context_getter_.get())); | 228 this, url_request_context_getter_.get())); |
229 #endif | 229 #endif |
230 | 230 |
231 if (IsIncidentReportingServiceEnabled()) { | 231 if (IsIncidentReportingServiceEnabled()) { |
232 incident_service_.reset(new safe_browsing::IncidentReportingService( | 232 incident_service_.reset(new safe_browsing::IncidentReportingService( |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 #endif | 436 #endif |
437 | 437 |
438 // Mark client string to allow server to differentiate mobile. | 438 // Mark client string to allow server to differentiate mobile. |
439 #if defined(OS_ANDROID) | 439 #if defined(OS_ANDROID) |
440 config.client_name.append("-a"); | 440 config.client_name.append("-a"); |
441 #elif defined(OS_IOS) | 441 #elif defined(OS_IOS) |
442 config.client_name.append("-i"); | 442 config.client_name.append("-i"); |
443 #endif | 443 #endif |
444 | 444 |
445 #endif // defined(OS_WIN) | 445 #endif // defined(OS_WIN) |
446 CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 446 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
447 config.disable_auto_update = | 447 config.disable_auto_update = |
448 cmdline->HasSwitch(switches::kSbDisableAutoUpdate) || | 448 cmdline->HasSwitch(switches::kSbDisableAutoUpdate) || |
449 cmdline->HasSwitch(switches::kDisableBackgroundNetworking); | 449 cmdline->HasSwitch(switches::kDisableBackgroundNetworking); |
450 config.url_prefix = kSbDefaultURLPrefix; | 450 config.url_prefix = kSbDefaultURLPrefix; |
451 config.backup_connect_error_url_prefix = kSbBackupConnectErrorURLPrefix; | 451 config.backup_connect_error_url_prefix = kSbBackupConnectErrorURLPrefix; |
452 config.backup_http_error_url_prefix = kSbBackupHttpErrorURLPrefix; | 452 config.backup_http_error_url_prefix = kSbBackupHttpErrorURLPrefix; |
453 config.backup_network_error_url_prefix = kSbBackupNetworkErrorURLPrefix; | 453 config.backup_network_error_url_prefix = kSbBackupNetworkErrorURLPrefix; |
454 | 454 |
455 return config; | 455 return config; |
456 } | 456 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 else | 577 else |
578 Stop(false); | 578 Stop(false); |
579 | 579 |
580 #if defined(FULL_SAFE_BROWSING) | 580 #if defined(FULL_SAFE_BROWSING) |
581 if (csd_service_) | 581 if (csd_service_) |
582 csd_service_->SetEnabledAndRefreshState(enable); | 582 csd_service_->SetEnabledAndRefreshState(enable); |
583 if (download_service_) | 583 if (download_service_) |
584 download_service_->SetEnabled(enable); | 584 download_service_->SetEnabled(enable); |
585 #endif | 585 #endif |
586 } | 586 } |
OLD | NEW |