Chromium Code Reviews| Index: chrome/browser/safe_browsing/safe_browsing_service.h |
| diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h |
| index 1d99f300dd8e17c6827bc5772a47c64fa066d97d..b37a53f74a9c2cc19a26d987d105d7954074d7db 100644 |
| --- a/chrome/browser/safe_browsing/safe_browsing_service.h |
| +++ b/chrome/browser/safe_browsing/safe_browsing_service.h |
| @@ -20,6 +20,7 @@ |
| #include "base/observer_list.h" |
| #include "base/sequenced_task_runner_helpers.h" |
| #include "chrome/browser/safe_browsing/services_delegate.h" |
| +#include "components/keyed_service/core/keyed_service_shutdown_notifier.h" |
| #include "components/safe_browsing_db/safe_browsing_prefs.h" |
| #include "components/safe_browsing_db/util.h" |
| #include "components/safe_browsing_db/v4_feature_list.h" |
| @@ -54,6 +55,7 @@ namespace safe_browsing { |
| class ClientSideDetectionService; |
| class DownloadProtectionService; |
| class PasswordProtectionService; |
| +class ChromePasswordProtectionService; |
| struct ResourceRequestInfo; |
| struct SafeBrowsingProtocolConfig; |
| class SafeBrowsingDatabaseManager; |
| @@ -163,7 +165,9 @@ class SafeBrowsingService : public base::RefCountedThreadSafe< |
| const scoped_refptr<SafeBrowsingDatabaseManager>& v4_local_database_manager() |
| const; |
| - PasswordProtectionService* password_protection_service(); |
| + // Gets PasswordProtectionService by profile. |
| + PasswordProtectionService* GetPasswordProtectionService( |
| + Profile* profile) const; |
| // Returns a preference validation delegate that adds incidents to the |
| // incident reporting service for validation failures. Returns NULL if the |
| @@ -274,6 +278,12 @@ class SafeBrowsingService : public base::RefCountedThreadSafe< |
| // Process the observed resource requests on the UI thread. |
| void ProcessResourceRequest(const ResourceRequestInfo& request); |
| + void CreatePasswordProtectionService(Profile* profile); |
| + |
| + void RemovePasswordProtectionService(Profile* profile); |
| + |
| + void OnProfileDestroyed(Profile* profile); |
|
Nathan Parker
2017/04/05 18:05:22
Comment for this one? Isn't not obvious what ti d
Jialiu Lin
2017/04/05 18:48:25
Oops, I forgot to remove this function. It is not
|
| + |
| // The factory used to instantiate a SafeBrowsingService object. |
| // Useful for tests, so they can provide their own implementation of |
| // SafeBrowsingService. |
| @@ -320,7 +330,7 @@ class SafeBrowsingService : public base::RefCountedThreadSafe< |
| std::map<PrefService*, std::unique_ptr<PrefChangeRegistrar>> prefs_map_; |
| // Used to track creation and destruction of profiles on the UI thread. |
| - content::NotificationRegistrar prefs_registrar_; |
| + content::NotificationRegistrar profiles_registrar_; |
| // Callbacks when SafeBrowsing state might have changed. |
| // Should only be accessed on the UI thread. |
| @@ -343,9 +353,15 @@ class SafeBrowsingService : public base::RefCountedThreadSafe< |
| scoped_refptr<SafeBrowsingNavigationObserverManager> |
| navigation_observer_manager_; |
| - // The password protection service detects and handles password related |
| - // incidents. |
| - std::unique_ptr<PasswordProtectionService> password_protection_service_; |
| + // Tracks existing Profiles, and their corresponding |
| + // ChromePasswordProtectionService instances. |
| + // Accessed on UI thread. |
| + std::map<Profile*, std::unique_ptr<ChromePasswordProtectionService>> |
| + password_protection_service_map_; |
| + |
| + std::map<Profile*, |
| + std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>> |
| + profile_shutdown_notifiers_; |
|
Nathan Parker
2017/04/05 18:05:22
Is this used? I didn't see it.
Jialiu Lin
2017/04/05 18:48:25
You're right. this is not needed.
|
| DISALLOW_COPY_AND_ASSIGN(SafeBrowsingService); |
| }; |