| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 extern const char kPasswordOnFocusRequestOutcomeHistogramName[]; | 43 extern const char kPasswordOnFocusRequestOutcomeHistogramName[]; |
| 44 extern const char kPasswordEntryRequestOutcomeHistogramName[]; | 44 extern const char kPasswordEntryRequestOutcomeHistogramName[]; |
| 45 | 45 |
| 46 // Manage password protection pings and verdicts. There is one instance of this | 46 // Manage password protection pings and verdicts. There is one instance of this |
| 47 // class per profile. Therefore, every PasswordProtectionService instance is | 47 // class per profile. Therefore, every PasswordProtectionService instance is |
| 48 // associated with a unique HistoryService instance and a unique | 48 // associated with a unique HistoryService instance and a unique |
| 49 // HostContentSettingsMap instance. | 49 // HostContentSettingsMap instance. |
| 50 class PasswordProtectionService : public history::HistoryServiceObserver { | 50 class PasswordProtectionService : public history::HistoryServiceObserver { |
| 51 public: | 51 public: |
| 52 using TriggerType = LoginReputationClientRequest::TriggerType; | 52 using TriggerType = LoginReputationClientRequest::TriggerType; |
| 53 using SyncAccountType = |
| 54 LoginReputationClientRequest::PasswordReuseEvent::SyncAccountType; |
| 55 |
| 53 // The outcome of the request. These values are used for UMA. | 56 // The outcome of the request. These values are used for UMA. |
| 54 // DO NOT CHANGE THE ORDERING OF THESE VALUES. | 57 // DO NOT CHANGE THE ORDERING OF THESE VALUES. |
| 55 enum RequestOutcome { | 58 enum RequestOutcome { |
| 56 UNKNOWN = 0, | 59 UNKNOWN = 0, |
| 57 SUCCEEDED = 1, | 60 SUCCEEDED = 1, |
| 58 CANCELED = 2, | 61 CANCELED = 2, |
| 59 TIMEDOUT = 3, | 62 TIMEDOUT = 3, |
| 60 MATCHED_WHITELIST = 4, | 63 MATCHED_WHITELIST = 4, |
| 61 RESPONSE_ALREADY_CACHED = 5, | 64 RESPONSE_ALREADY_CACHED = 5, |
| 62 DEPRECATED_NO_EXTENDED_REPORTING = 6, | 65 DEPRECATED_NO_EXTENDED_REPORTING = 6, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 188 |
| 186 virtual bool IsPingingEnabled(const base::Feature& feature, | 189 virtual bool IsPingingEnabled(const base::Feature& feature, |
| 187 RequestOutcome* reason) = 0; | 190 RequestOutcome* reason) = 0; |
| 188 | 191 |
| 189 virtual bool IsHistorySyncEnabled() = 0; | 192 virtual bool IsHistorySyncEnabled() = 0; |
| 190 | 193 |
| 191 virtual void ShowPhishingInterstitial(const GURL& phishing_url, | 194 virtual void ShowPhishingInterstitial(const GURL& phishing_url, |
| 192 const std::string& token, | 195 const std::string& token, |
| 193 content::WebContents* web_contents) = 0; | 196 content::WebContents* web_contents) = 0; |
| 194 | 197 |
| 198 // Gets the type of sync account associated with current profile or |
| 199 // |NOT_SIGNED_IN|. |
| 200 virtual SyncAccountType GetSyncAccountType() = 0; |
| 201 |
| 195 void CheckCsdWhitelistOnIOThread(const GURL& url, bool* check_result); | 202 void CheckCsdWhitelistOnIOThread(const GURL& url, bool* check_result); |
| 196 | 203 |
| 197 HostContentSettingsMap* content_settings() const { return content_settings_; } | 204 HostContentSettingsMap* content_settings() const { return content_settings_; } |
| 198 | 205 |
| 199 private: | 206 private: |
| 200 friend class PasswordProtectionServiceTest; | 207 friend class PasswordProtectionServiceTest; |
| 201 friend class TestPasswordProtectionService; | 208 friend class TestPasswordProtectionService; |
| 202 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, | 209 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, |
| 203 TestParseInvalidVerdictEntry); | 210 TestParseInvalidVerdictEntry); |
| 204 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, | 211 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // we need CancelableTaskTracker to cancel tasks posted to IO thread. | 290 // we need CancelableTaskTracker to cancel tasks posted to IO thread. |
| 284 base::CancelableTaskTracker tracker_; | 291 base::CancelableTaskTracker tracker_; |
| 285 | 292 |
| 286 base::WeakPtrFactory<PasswordProtectionService> weak_factory_; | 293 base::WeakPtrFactory<PasswordProtectionService> weak_factory_; |
| 287 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService); | 294 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService); |
| 288 }; | 295 }; |
| 289 | 296 |
| 290 } // namespace safe_browsing | 297 } // namespace safe_browsing |
| 291 | 298 |
| 292 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERV
ICE_H_ | 299 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERV
ICE_H_ |
| OLD | NEW |