| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE
_H_ | 5 #ifndef COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE
_H_ |
| 6 #define COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE
_H_ | 6 #define COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERVICE
_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 class GURL; | 28 class GURL; |
| 29 class HostContentSettingsMap; | 29 class HostContentSettingsMap; |
| 30 | 30 |
| 31 namespace safe_browsing { | 31 namespace safe_browsing { |
| 32 | 32 |
| 33 class SafeBrowsingDatabaseManager; | 33 class SafeBrowsingDatabaseManager; |
| 34 class PasswordProtectionRequest; | 34 class PasswordProtectionRequest; |
| 35 | 35 |
| 36 extern const base::Feature kPasswordFieldOnFocusPinging; | 36 extern const base::Feature kPasswordFieldOnFocusPinging; |
| 37 extern const base::Feature kProtectedPasswordEntryPinging; | 37 extern const base::Feature kProtectedPasswordEntryPinging; |
| 38 extern const char kPasswordOnFocusRequestOutcomeHistogramName[]; |
| 39 extern const char kPasswordEntryRequestOutcomeHistogramName[]; |
| 38 | 40 |
| 39 // Manage password protection pings and verdicts. There is one instance of this | 41 // Manage password protection pings and verdicts. There is one instance of this |
| 40 // class per profile. Therefore, every PasswordProtectionService instance is | 42 // class per profile. Therefore, every PasswordProtectionService instance is |
| 41 // associated with a unique HistoryService instance and a unique | 43 // associated with a unique HistoryService instance and a unique |
| 42 // HostContentSettingsMap instance. | 44 // HostContentSettingsMap instance. |
| 43 class PasswordProtectionService : public history::HistoryServiceObserver { | 45 class PasswordProtectionService : public history::HistoryServiceObserver { |
| 44 public: | 46 public: |
| 47 // The outcome of the request. These values are used for UMA. |
| 48 // DO NOT CHANGE THE ORDERING OF THESE VALUES. |
| 49 enum RequestOutcome { |
| 50 UNKNOWN = 0, |
| 51 SUCCEEDED = 1, |
| 52 CANCELED = 2, |
| 53 TIMEDOUT = 3, |
| 54 MATCHED_WHITELIST = 4, |
| 55 RESPONSE_ALREADY_CACHED = 5, |
| 56 DEPRECATED_NO_EXTENDED_REPORTING = 6, |
| 57 DISABLED_DUE_TO_INCOGNITO = 7, |
| 58 REQUEST_MALFORMED = 8, |
| 59 FETCH_FAILED = 9, |
| 60 RESPONSE_MALFORMED = 10, |
| 61 SERVICE_DESTROYED = 11, |
| 62 DISABLED_DUE_TO_FEATURE_DISABLED = 12, |
| 63 DISABLED_DUE_TO_USER_POPULATION = 13, |
| 64 MAX_OUTCOME |
| 65 }; |
| 45 PasswordProtectionService( | 66 PasswordProtectionService( |
| 46 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager, | 67 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager, |
| 47 scoped_refptr<net::URLRequestContextGetter> request_context_getter, | 68 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
| 48 history::HistoryService* history_service, | 69 history::HistoryService* history_service, |
| 49 HostContentSettingsMap* host_content_settings_map); | 70 HostContentSettingsMap* host_content_settings_map); |
| 50 | 71 |
| 51 ~PasswordProtectionService() override; | 72 ~PasswordProtectionService() override; |
| 52 | 73 |
| 53 base::WeakPtr<PasswordProtectionService> GetWeakPtr() { | 74 base::WeakPtr<PasswordProtectionService> GetWeakPtr() { |
| 54 return weak_factory_.GetWeakPtr(); | 75 return weak_factory_.GetWeakPtr(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 72 const base::Time& receive_time); | 93 const base::Time& receive_time); |
| 73 | 94 |
| 74 // Creates an instance of PasswordProtectionRequest and call Start() on that | 95 // Creates an instance of PasswordProtectionRequest and call Start() on that |
| 75 // instance. This function also insert this request object in |requests_| for | 96 // instance. This function also insert this request object in |requests_| for |
| 76 // record keeping. | 97 // record keeping. |
| 77 void StartRequest(const GURL& main_frame_url, | 98 void StartRequest(const GURL& main_frame_url, |
| 78 const GURL& password_form_action, | 99 const GURL& password_form_action, |
| 79 const GURL& password_form_frame_url, | 100 const GURL& password_form_frame_url, |
| 80 LoginReputationClientRequest::TriggerType type); | 101 LoginReputationClientRequest::TriggerType type); |
| 81 | 102 |
| 82 virtual void MaybeStartLowReputationRequest( | 103 virtual void MaybeStartPasswordFieldOnFocusRequest( |
| 83 const GURL& main_frame_url, | 104 const GURL& main_frame_url, |
| 84 const GURL& password_form_action, | 105 const GURL& password_form_action, |
| 85 const GURL& password_form_frame_url); | 106 const GURL& password_form_frame_url); |
| 86 | 107 |
| 87 scoped_refptr<SafeBrowsingDatabaseManager> database_manager(); | 108 scoped_refptr<SafeBrowsingDatabaseManager> database_manager(); |
| 88 | 109 |
| 89 protected: | 110 protected: |
| 90 friend class PasswordProtectionRequest; | 111 friend class PasswordProtectionRequest; |
| 91 | 112 |
| 92 // Called by a PasswordProtectionRequest instance when it finishes to remove | 113 // Called by a PasswordProtectionRequest instance when it finishes to remove |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // we need CancelableTaskTracker to cancel tasks posted to IO thread. | 231 // we need CancelableTaskTracker to cancel tasks posted to IO thread. |
| 211 base::CancelableTaskTracker tracker_; | 232 base::CancelableTaskTracker tracker_; |
| 212 | 233 |
| 213 base::WeakPtrFactory<PasswordProtectionService> weak_factory_; | 234 base::WeakPtrFactory<PasswordProtectionService> weak_factory_; |
| 214 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService); | 235 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService); |
| 215 }; | 236 }; |
| 216 | 237 |
| 217 } // namespace safe_browsing | 238 } // namespace safe_browsing |
| 218 | 239 |
| 219 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERV
ICE_H_ | 240 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERV
ICE_H_ |
| OLD | NEW |