| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 STLDeleteValues(&prefs_map_); | 273 STLDeleteValues(&prefs_map_); |
| 274 | 274 |
| 275 // Remove Profile creation/destruction observers. | 275 // Remove Profile creation/destruction observers. |
| 276 prefs_registrar_.RemoveAll(); | 276 prefs_registrar_.RemoveAll(); |
| 277 | 277 |
| 278 Stop(true); | 278 Stop(true); |
| 279 // The IO thread is going away, so make sure the ClientSideDetectionService | 279 // The IO thread is going away, so make sure the ClientSideDetectionService |
| 280 // dtor executes now since it may call the dtor of URLFetcher which relies | 280 // dtor executes now since it may call the dtor of URLFetcher which relies |
| 281 // on it. | 281 // on it. |
| 282 csd_service_.reset(); | 282 csd_service_.reset(); |
| 283 incident_service_.reset(); |
| 283 download_service_.reset(); | 284 download_service_.reset(); |
| 284 incident_service_.reset(); | |
| 285 | 285 |
| 286 url_request_context_getter_ = NULL; | 286 url_request_context_getter_ = NULL; |
| 287 BrowserThread::PostNonNestableTask( | 287 BrowserThread::PostNonNestableTask( |
| 288 BrowserThread::IO, FROM_HERE, | 288 BrowserThread::IO, FROM_HERE, |
| 289 base::Bind(&SafeBrowsingService::DestroyURLRequestContextOnIOThread, | 289 base::Bind(&SafeBrowsingService::DestroyURLRequestContextOnIOThread, |
| 290 this)); | 290 this)); |
| 291 } | 291 } |
| 292 | 292 |
| 293 // Binhash verification is only enabled for UMA users for now. | 293 // Binhash verification is only enabled for UMA users for now. |
| 294 bool SafeBrowsingService::DownloadBinHashNeeded() const { | 294 bool SafeBrowsingService::DownloadBinHashNeeded() const { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 } | 340 } |
| 341 | 341 |
| 342 void SafeBrowsingService::RegisterDelayedAnalysisCallback( | 342 void SafeBrowsingService::RegisterDelayedAnalysisCallback( |
| 343 const safe_browsing::DelayedAnalysisCallback& callback) { | 343 const safe_browsing::DelayedAnalysisCallback& callback) { |
| 344 #if defined(FULL_SAFE_BROWSING) | 344 #if defined(FULL_SAFE_BROWSING) |
| 345 if (incident_service_) | 345 if (incident_service_) |
| 346 incident_service_->RegisterDelayedAnalysisCallback(callback); | 346 incident_service_->RegisterDelayedAnalysisCallback(callback); |
| 347 #endif | 347 #endif |
| 348 } | 348 } |
| 349 | 349 |
| 350 void SafeBrowsingService::AddDownloadManager( |
| 351 content::DownloadManager* download_manager) { |
| 352 #if defined(FULL_SAFE_BROWSING) |
| 353 if (incident_service_) |
| 354 incident_service_->AddDownloadManager(download_manager); |
| 355 #endif |
| 356 } |
| 357 |
| 350 SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() { | 358 SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() { |
| 351 return new SafeBrowsingUIManager(this); | 359 return new SafeBrowsingUIManager(this); |
| 352 } | 360 } |
| 353 | 361 |
| 354 SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() { | 362 SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() { |
| 355 #if defined(FULL_SAFE_BROWSING) | 363 #if defined(FULL_SAFE_BROWSING) |
| 356 return new SafeBrowsingDatabaseManager(this); | 364 return new SafeBrowsingDatabaseManager(this); |
| 357 #else | 365 #else |
| 358 return NULL; | 366 return NULL; |
| 359 #endif | 367 #endif |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 else | 565 else |
| 558 Stop(false); | 566 Stop(false); |
| 559 | 567 |
| 560 #if defined(FULL_SAFE_BROWSING) | 568 #if defined(FULL_SAFE_BROWSING) |
| 561 if (csd_service_) | 569 if (csd_service_) |
| 562 csd_service_->SetEnabledAndRefreshState(enable); | 570 csd_service_->SetEnabledAndRefreshState(enable); |
| 563 if (download_service_) | 571 if (download_service_) |
| 564 download_service_->SetEnabled(enable); | 572 download_service_->SetEnabled(enable); |
| 565 #endif | 573 #endif |
| 566 } | 574 } |
| OLD | NEW |