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" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/debug/leak_tracker.h" | 13 #include "base/debug/leak_tracker.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/prefs/pref_change_registrar.h" | 16 #include "base/prefs/pref_change_registrar.h" |
17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
| 18 #include "base/profiler/scoped_tracker.h" |
18 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
20 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
21 #include "base/threading/thread_restrictions.h" | 22 #include "base/threading/thread_restrictions.h" |
22 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" |
24 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" | 25 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" |
25 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
26 #include "chrome/browser/profiles/profile_manager.h" | 27 #include "chrome/browser/profiles/profile_manager.h" |
27 #include "chrome/browser/safe_browsing/client_side_detection_service.h" | 28 #include "chrome/browser/safe_browsing/client_side_detection_service.h" |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 return config; | 456 return config; |
456 } | 457 } |
457 | 458 |
458 void SafeBrowsingService::StartOnIOThread( | 459 void SafeBrowsingService::StartOnIOThread( |
459 net::URLRequestContextGetter* url_request_context_getter) { | 460 net::URLRequestContextGetter* url_request_context_getter) { |
460 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 461 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
461 if (enabled_) | 462 if (enabled_) |
462 return; | 463 return; |
463 enabled_ = true; | 464 enabled_ = true; |
464 | 465 |
| 466 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455469 is fixed. |
| 467 tracked_objects::ScopedTracker tracking_profile1( |
| 468 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 469 "455469 SafeBrowsingService::GetProtocolConfig")); |
465 SafeBrowsingProtocolConfig config = GetProtocolConfig(); | 470 SafeBrowsingProtocolConfig config = GetProtocolConfig(); |
466 | 471 |
467 #if defined(FULL_SAFE_BROWSING) | 472 #if defined(FULL_SAFE_BROWSING) |
| 473 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455469 is fixed. |
| 474 tracked_objects::ScopedTracker tracking_profile2( |
| 475 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 476 "455469 SafeBrowsingDatabaseManager::StartOnIOThread")); |
468 DCHECK(database_manager_.get()); | 477 DCHECK(database_manager_.get()); |
469 database_manager_->StartOnIOThread(); | 478 database_manager_->StartOnIOThread(); |
470 | 479 |
| 480 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455469 is fixed. |
| 481 tracked_objects::ScopedTracker tracking_profile3( |
| 482 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 483 "455469 SafeBrowsingProtocolManager::Create")); |
471 DCHECK(!protocol_manager_); | 484 DCHECK(!protocol_manager_); |
472 protocol_manager_ = SafeBrowsingProtocolManager::Create( | 485 protocol_manager_ = SafeBrowsingProtocolManager::Create( |
473 database_manager_.get(), url_request_context_getter, config); | 486 database_manager_.get(), url_request_context_getter, config); |
474 protocol_manager_->Initialize(); | 487 protocol_manager_->Initialize(); |
475 #endif | 488 #endif |
476 | 489 |
| 490 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455469 is fixed. |
| 491 tracked_objects::ScopedTracker tracking_profile4( |
| 492 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 493 "455469 SafeBrowsingPingManager::Create")); |
477 DCHECK(!ping_manager_); | 494 DCHECK(!ping_manager_); |
478 ping_manager_ = SafeBrowsingPingManager::Create( | 495 ping_manager_ = SafeBrowsingPingManager::Create( |
479 url_request_context_getter, config); | 496 url_request_context_getter, config); |
480 } | 497 } |
481 | 498 |
482 void SafeBrowsingService::StopOnIOThread(bool shutdown) { | 499 void SafeBrowsingService::StopOnIOThread(bool shutdown) { |
483 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 500 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
484 | 501 |
485 #if defined(FULL_SAFE_BROWSING) | 502 #if defined(FULL_SAFE_BROWSING) |
486 database_manager_->StopOnIOThread(shutdown); | 503 database_manager_->StopOnIOThread(shutdown); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 else | 594 else |
578 Stop(false); | 595 Stop(false); |
579 | 596 |
580 #if defined(FULL_SAFE_BROWSING) | 597 #if defined(FULL_SAFE_BROWSING) |
581 if (csd_service_) | 598 if (csd_service_) |
582 csd_service_->SetEnabledAndRefreshState(enable); | 599 csd_service_->SetEnabledAndRefreshState(enable); |
583 if (download_service_) | 600 if (download_service_) |
584 download_service_->SetEnabled(enable); | 601 download_service_->SetEnabled(enable); |
585 #endif | 602 #endif |
586 } | 603 } |
OLD | NEW |