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 21 matching lines...) Expand all Loading... | |
32 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager .h" | 32 #include "chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager .h" |
33 #include "chrome/browser/safe_browsing/ui_manager.h" | 33 #include "chrome/browser/safe_browsing/ui_manager.h" |
34 #include "chrome/common/chrome_paths.h" | 34 #include "chrome/common/chrome_paths.h" |
35 #include "chrome/common/chrome_switches.h" | 35 #include "chrome/common/chrome_switches.h" |
36 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
37 #include "chrome/common/safe_browsing/file_type_policies.h" | 37 #include "chrome/common/safe_browsing/file_type_policies.h" |
38 #include "components/prefs/pref_change_registrar.h" | 38 #include "components/prefs/pref_change_registrar.h" |
39 #include "components/prefs/pref_service.h" | 39 #include "components/prefs/pref_service.h" |
40 #include "components/safe_browsing/common/safebrowsing_constants.h" | 40 #include "components/safe_browsing/common/safebrowsing_constants.h" |
41 #include "components/safe_browsing/common/safebrowsing_switches.h" | 41 #include "components/safe_browsing/common/safebrowsing_switches.h" |
42 #include "components/safe_browsing/triggers/trigger_manager.h" | |
42 #include "components/safe_browsing_db/database_manager.h" | 43 #include "components/safe_browsing_db/database_manager.h" |
43 #include "components/safe_browsing_db/v4_feature_list.h" | 44 #include "components/safe_browsing_db/v4_feature_list.h" |
44 #include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" | 45 #include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" |
45 #include "components/safe_browsing_db/v4_local_database_manager.h" | 46 #include "components/safe_browsing_db/v4_local_database_manager.h" |
46 #include "content/public/browser/browser_thread.h" | 47 #include "content/public/browser/browser_thread.h" |
47 #include "content/public/browser/cookie_store_factory.h" | 48 #include "content/public/browser/cookie_store_factory.h" |
48 #include "content/public/browser/notification_service.h" | 49 #include "content/public/browser/notification_service.h" |
49 #include "content/public/browser/resource_request_info.h" | 50 #include "content/public/browser/resource_request_info.h" |
50 #include "google_apis/google_api_keys.h" | 51 #include "google_apis/google_api_keys.h" |
51 #include "net/cookies/cookie_store.h" | 52 #include "net/cookies/cookie_store.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 } | 326 } |
326 | 327 |
327 if (base::FeatureList::IsEnabled( | 328 if (base::FeatureList::IsEnabled( |
328 SafeBrowsingNavigationObserverManager::kDownloadAttribution)) { | 329 SafeBrowsingNavigationObserverManager::kDownloadAttribution)) { |
329 navigation_observer_manager_ = new SafeBrowsingNavigationObserverManager(); | 330 navigation_observer_manager_ = new SafeBrowsingNavigationObserverManager(); |
330 } | 331 } |
331 | 332 |
332 services_delegate_->Initialize(v4_enabled_); | 333 services_delegate_->Initialize(v4_enabled_); |
333 services_delegate_->InitializeCsdService(url_request_context_getter_.get()); | 334 services_delegate_->InitializeCsdService(url_request_context_getter_.get()); |
334 | 335 |
336 CreateTriggerManager(); | |
337 | |
335 // Track profile creation and destruction. | 338 // Track profile creation and destruction. |
336 profiles_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, | 339 profiles_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, |
337 content::NotificationService::AllSources()); | 340 content::NotificationService::AllSources()); |
338 profiles_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, | 341 profiles_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, |
339 content::NotificationService::AllSources()); | 342 content::NotificationService::AllSources()); |
340 | 343 |
341 // Register all the delayed analysis to the incident reporting service. | 344 // Register all the delayed analysis to the incident reporting service. |
342 RegisterAllDelayedAnalysis(); | 345 RegisterAllDelayedAnalysis(); |
343 } | 346 } |
344 | 347 |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
772 } | 775 } |
773 | 776 |
774 void SafeBrowsingService::RemovePasswordProtectionService(Profile* profile) { | 777 void SafeBrowsingService::RemovePasswordProtectionService(Profile* profile) { |
775 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 778 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
776 DCHECK(profile); | 779 DCHECK(profile); |
777 auto it = password_protection_service_map_.find(profile); | 780 auto it = password_protection_service_map_.find(profile); |
778 if (it != password_protection_service_map_.end()) | 781 if (it != password_protection_service_map_.end()) |
779 password_protection_service_map_.erase(it); | 782 password_protection_service_map_.erase(it); |
780 } | 783 } |
781 | 784 |
785 void SafeBrowsingService::CreateTriggerManager() { | |
Jialiu Lin
2017/05/04 15:53:38
How does TriggerManager tie to profile? If Trigg
lpz
2017/05/04 17:51:53
Good question. I've been thinking of TriggerManage
Jialiu Lin
2017/05/04 18:29:47
(1) If you're only interested in creation and dest
lpz
2017/05/04 18:49:47
As discussed offline, will keep it under component
| |
786 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
787 trigger_manager_ = base::MakeUnique<TriggerManager>(); | |
788 } | |
782 } // namespace safe_browsing | 789 } // namespace safe_browsing |
OLD | NEW |