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