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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 | 635 |
636 // Record the current pref state. | 636 // Record the current pref state. |
637 UMA_HISTOGRAM_BOOLEAN("SafeBrowsing.Pref.General", | 637 UMA_HISTOGRAM_BOOLEAN("SafeBrowsing.Pref.General", |
638 pref_service->GetBoolean(prefs::kSafeBrowsingEnabled)); | 638 pref_service->GetBoolean(prefs::kSafeBrowsingEnabled)); |
639 UMA_HISTOGRAM_BOOLEAN( | 639 UMA_HISTOGRAM_BOOLEAN( |
640 "SafeBrowsing.Pref.Extended", | 640 "SafeBrowsing.Pref.Extended", |
641 pref_service->GetBoolean(prefs::kSafeBrowsingExtendedReportingEnabled)); | 641 pref_service->GetBoolean(prefs::kSafeBrowsingExtendedReportingEnabled)); |
642 } | 642 } |
643 | 643 |
644 void SafeBrowsingService::RemovePrefService(PrefService* pref_service) { | 644 void SafeBrowsingService::RemovePrefService(PrefService* pref_service) { |
| 645 // It is possible to have RemovePrefService called without a prior call to |
| 646 // AddPrefService if profile initialization fails. |
645 if (prefs_map_.find(pref_service) != prefs_map_.end()) { | 647 if (prefs_map_.find(pref_service) != prefs_map_.end()) { |
646 delete prefs_map_[pref_service]; | 648 delete prefs_map_[pref_service]; |
647 prefs_map_.erase(pref_service); | 649 prefs_map_.erase(pref_service); |
648 RefreshState(); | 650 RefreshState(); |
649 } else { | |
650 NOTREACHED(); | |
651 } | 651 } |
652 } | 652 } |
653 | 653 |
654 std::unique_ptr<SafeBrowsingService::StateSubscription> | 654 std::unique_ptr<SafeBrowsingService::StateSubscription> |
655 SafeBrowsingService::RegisterStateCallback( | 655 SafeBrowsingService::RegisterStateCallback( |
656 const base::Callback<void(void)>& callback) { | 656 const base::Callback<void(void)>& callback) { |
657 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 657 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
658 return state_callback_list_.Add(callback); | 658 return state_callback_list_.Add(callback); |
659 } | 659 } |
660 | 660 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 ping_manager()->ReportThreatDetails(report); | 698 ping_manager()->ReportThreatDetails(report); |
699 } | 699 } |
700 | 700 |
701 void SafeBrowsingService::ProcessResourceRequest( | 701 void SafeBrowsingService::ProcessResourceRequest( |
702 const ResourceRequestInfo& request) { | 702 const ResourceRequestInfo& request) { |
703 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 703 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
704 services_delegate_->ProcessResourceRequest(&request); | 704 services_delegate_->ProcessResourceRequest(&request); |
705 } | 705 } |
706 | 706 |
707 } // namespace safe_browsing | 707 } // namespace safe_browsing |
OLD | NEW |