Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: components/safe_browsing/password_protection/password_protection_service.h

Issue 2878813002: Trigger protected password entry request on password reuse event. (Closed)
Patch Set: nit Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 scoped_refptr<net::URLRequestContextGetter> request_context_getter, 68 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
69 history::HistoryService* history_service, 69 history::HistoryService* history_service,
70 HostContentSettingsMap* host_content_settings_map); 70 HostContentSettingsMap* host_content_settings_map);
71 71
72 ~PasswordProtectionService() override; 72 ~PasswordProtectionService() override;
73 73
74 base::WeakPtr<PasswordProtectionService> GetWeakPtr() { 74 base::WeakPtr<PasswordProtectionService> GetWeakPtr() {
75 return weak_factory_.GetWeakPtr(); 75 return weak_factory_.GetWeakPtr();
76 } 76 }
77 77
78 // Checks if |url| matches CSD whitelist and record UMA metric accordingly.
79 // Currently called by PasswordReuseDetectionManager on UI thread.
80 void RecordPasswordReuse(const GURL& url);
81
82 // Looks up |settings| to find the cached verdict response. If verdict is not 78 // Looks up |settings| to find the cached verdict response. If verdict is not
83 // available or is expired, return VERDICT_TYPE_UNSPECIFIED. Can be called on 79 // available or is expired, return VERDICT_TYPE_UNSPECIFIED. Can be called on
84 // any thread. 80 // any thread.
85 LoginReputationClientResponse::VerdictType GetCachedVerdict( 81 LoginReputationClientResponse::VerdictType GetCachedVerdict(
86 const GURL& url, 82 const GURL& url,
87 LoginReputationClientResponse* out_response); 83 LoginReputationClientResponse* out_response);
88 84
89 // Stores |verdict| in |settings| based on |url|, |verdict| and 85 // Stores |verdict| in |settings| based on |url|, |verdict| and
90 // |receive_time|. 86 // |receive_time|.
91 void CacheVerdict(const GURL& url, 87 void CacheVerdict(const GURL& url,
92 LoginReputationClientResponse* verdict, 88 LoginReputationClientResponse* verdict,
93 const base::Time& receive_time); 89 const base::Time& receive_time);
94 90
95 // Removes all the expired verdicts from cache. 91 // Removes all the expired verdicts from cache.
96 void CleanUpExpiredVerdicts(); 92 void CleanUpExpiredVerdicts();
97 93
98 // Creates an instance of PasswordProtectionRequest and call Start() on that 94 // Creates an instance of PasswordProtectionRequest and call Start() on that
99 // instance. This function also insert this request object in |requests_| for 95 // instance. This function also insert this request object in |requests_| for
100 // record keeping. 96 // record keeping.
101 void StartRequest(const GURL& main_frame_url, 97 void StartRequest(const GURL& main_frame_url,
102 const GURL& password_form_action, 98 const GURL& password_form_action,
103 const GURL& password_form_frame_url, 99 const GURL& password_form_frame_url,
100 const std::string& saved_domain,
104 LoginReputationClientRequest::TriggerType type); 101 LoginReputationClientRequest::TriggerType type);
105 102
106 virtual void MaybeStartPasswordFieldOnFocusRequest( 103 virtual void MaybeStartPasswordFieldOnFocusRequest(
107 const GURL& main_frame_url, 104 const GURL& main_frame_url,
108 const GURL& password_form_action, 105 const GURL& password_form_action,
109 const GURL& password_form_frame_url); 106 const GURL& password_form_frame_url);
110 107
108 virtual void MaybeStartProtectedPasswordEntryRequest(
109 const GURL& main_frame_url,
110 const std::string& saved_domain);
111
111 scoped_refptr<SafeBrowsingDatabaseManager> database_manager(); 112 scoped_refptr<SafeBrowsingDatabaseManager> database_manager();
112 113
113 protected: 114 protected:
114 friend class PasswordProtectionRequest; 115 friend class PasswordProtectionRequest;
115 116
116 // Called by a PasswordProtectionRequest instance when it finishes to remove 117 // Called by a PasswordProtectionRequest instance when it finishes to remove
117 // itself from |requests_|. 118 // itself from |requests_|.
118 virtual void RequestFinished( 119 virtual void RequestFinished(
119 PasswordProtectionRequest* request, 120 PasswordProtectionRequest* request,
120 std::unique_ptr<LoginReputationClientResponse> response); 121 std::unique_ptr<LoginReputationClientResponse> response);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 153
153 virtual bool IsIncognito() = 0; 154 virtual bool IsIncognito() = 0;
154 155
155 virtual bool IsPingingEnabled(const base::Feature& feature, 156 virtual bool IsPingingEnabled(const base::Feature& feature,
156 RequestOutcome* reason) = 0; 157 RequestOutcome* reason) = 0;
157 158
158 virtual bool IsHistorySyncEnabled() = 0; 159 virtual bool IsHistorySyncEnabled() = 0;
159 160
160 void CheckCsdWhitelistOnIOThread(const GURL& url, bool* check_result); 161 void CheckCsdWhitelistOnIOThread(const GURL& url, bool* check_result);
161 162
162 // Increases "PasswordManager.PasswordReuse.MainFrameMatchCsdWhitelist" UMA
163 // metric based on input.
164 void OnMatchCsdWhiteListResult(const bool* match_whitelist);
165
166 HostContentSettingsMap* content_settings() const { return content_settings_; } 163 HostContentSettingsMap* content_settings() const { return content_settings_; }
167 164
168 private: 165 private:
169 friend class PasswordProtectionServiceTest; 166 friend class PasswordProtectionServiceTest;
170 friend class TestPasswordProtectionService; 167 friend class TestPasswordProtectionService;
171 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, 168 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest,
172 TestParseInvalidVerdictEntry); 169 TestParseInvalidVerdictEntry);
173 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, 170 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest,
174 TestParseValidVerdictEntry); 171 TestParseValidVerdictEntry);
175 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, 172 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // we need CancelableTaskTracker to cancel tasks posted to IO thread. 236 // we need CancelableTaskTracker to cancel tasks posted to IO thread.
240 base::CancelableTaskTracker tracker_; 237 base::CancelableTaskTracker tracker_;
241 238
242 base::WeakPtrFactory<PasswordProtectionService> weak_factory_; 239 base::WeakPtrFactory<PasswordProtectionService> weak_factory_;
243 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService); 240 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService);
244 }; 241 };
245 242
246 } // namespace safe_browsing 243 } // namespace safe_browsing
247 244
248 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERV ICE_H_ 245 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERV ICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698