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

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

Issue 2856033002: Add finch control of user population in low reputation requests (Closed)
Patch Set: replace PasswordReuse with ProtectedPasswordEntry 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"
11 #include "base/feature_list.h"
11 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/scoped_observer.h" 16 #include "base/scoped_observer.h"
16 #include "base/task/cancelable_task_tracker.h" 17 #include "base/task/cancelable_task_tracker.h"
17 #include "base/values.h" 18 #include "base/values.h"
18 #include "components/history/core/browser/history_service_observer.h" 19 #include "components/history/core/browser/history_service_observer.h"
19 #include "components/safe_browsing/csd.pb.h" 20 #include "components/safe_browsing/csd.pb.h"
20 #include "net/url_request/url_request_context_getter.h" 21 #include "net/url_request/url_request_context_getter.h"
21 #include "third_party/protobuf/src/google/protobuf/repeated_field.h" 22 #include "third_party/protobuf/src/google/protobuf/repeated_field.h"
22 23
23 namespace history { 24 namespace history {
24 class HistoryService; 25 class HistoryService;
25 } 26 }
26 27
27 class GURL; 28 class GURL;
28 class HostContentSettingsMap; 29 class HostContentSettingsMap;
29 30
30 namespace safe_browsing { 31 namespace safe_browsing {
31 32
32 class SafeBrowsingDatabaseManager; 33 class SafeBrowsingDatabaseManager;
33 class PasswordProtectionRequest; 34 class PasswordProtectionRequest;
34 35
36 extern const base::Feature kLowReputationPinging;
37 extern const base::Feature kProtectedPasswordEntryPinging;
38
35 // Manage password protection pings and verdicts. There is one instance of this 39 // Manage password protection pings and verdicts. There is one instance of this
36 // class per profile. Therefore, every PasswordProtectionService instance is 40 // class per profile. Therefore, every PasswordProtectionService instance is
37 // associated with a unique HistoryService instance and a unique 41 // associated with a unique HistoryService instance and a unique
38 // HostContentSettingsMap instance. 42 // HostContentSettingsMap instance.
39 class PasswordProtectionService : public history::HistoryServiceObserver { 43 class PasswordProtectionService : public history::HistoryServiceObserver {
40 public: 44 public:
41 PasswordProtectionService( 45 PasswordProtectionService(
42 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager, 46 const scoped_refptr<SafeBrowsingDatabaseManager>& database_manager,
43 scoped_refptr<net::URLRequestContextGetter> request_context_getter, 47 scoped_refptr<net::URLRequestContextGetter> request_context_getter,
44 history::HistoryService* history_service, 48 history::HistoryService* history_service,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Gets the request timeout in milliseconds. 113 // Gets the request timeout in milliseconds.
110 static int GetRequestTimeoutInMS(); 114 static int GetRequestTimeoutInMS();
111 115
112 // Obtains referrer chain of |event_url| and |event_tab_id| and adds this 116 // Obtains referrer chain of |event_url| and |event_tab_id| and adds this
113 // info into |frame|. 117 // info into |frame|.
114 virtual void FillReferrerChain( 118 virtual void FillReferrerChain(
115 const GURL& event_url, 119 const GURL& event_url,
116 int event_tab_id, // -1 if tab id is not available. 120 int event_tab_id, // -1 if tab id is not available.
117 LoginReputationClientRequest::Frame* frame) = 0; 121 LoginReputationClientRequest::Frame* frame) = 0;
118 122
123 void FillUserPopulation(
124 const LoginReputationClientRequest::TriggerType& request_type,
125 LoginReputationClientRequest* request_proto);
126
119 virtual bool IsExtendedReporting() = 0; 127 virtual bool IsExtendedReporting() = 0;
128
120 virtual bool IsIncognito() = 0; 129 virtual bool IsIncognito() = 0;
121 130
122 // If we can send ping to Safe Browsing backend. 131 virtual bool IsPingingEnabled(const base::Feature& feature) = 0;
123 virtual bool IsPingingEnabled() = 0; 132
133 virtual bool IsHistorySyncEnabled() = 0;
124 134
125 void CheckCsdWhitelistOnIOThread(const GURL& url, bool* check_result); 135 void CheckCsdWhitelistOnIOThread(const GURL& url, bool* check_result);
126 136
127 // Increases "PasswordManager.PasswordReuse.MainFrameMatchCsdWhitelist" UMA 137 // Increases "PasswordManager.PasswordReuse.MainFrameMatchCsdWhitelist" UMA
128 // metric based on input. 138 // metric based on input.
129 void OnMatchCsdWhiteListResult(const bool* match_whitelist); 139 void OnMatchCsdWhiteListResult(const bool* match_whitelist);
130 140
141 HostContentSettingsMap* content_settings() { return content_settings_; }
Nathan Parker 2017/05/05 20:58:22 nit: content_settings() const
Jialiu Lin 2017/05/05 22:19:33 Done.
142
131 private: 143 private:
132 friend class PasswordProtectionServiceTest; 144 friend class PasswordProtectionServiceTest;
133 friend class TestPasswordProtectionService; 145 friend class TestPasswordProtectionService;
134 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, 146 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest,
135 TestParseInvalidVerdictEntry); 147 TestParseInvalidVerdictEntry);
136 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, 148 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest,
137 TestParseValidVerdictEntry); 149 TestParseValidVerdictEntry);
138 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, 150 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest,
139 TestPathVariantsMatchCacheExpression); 151 TestPathVariantsMatchCacheExpression);
140 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest, 152 FRIEND_TEST_ALL_PREFIXES(PasswordProtectionServiceTest,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // we need CancelableTaskTracker to cancel tasks posted to IO thread. 210 // we need CancelableTaskTracker to cancel tasks posted to IO thread.
199 base::CancelableTaskTracker tracker_; 211 base::CancelableTaskTracker tracker_;
200 212
201 base::WeakPtrFactory<PasswordProtectionService> weak_factory_; 213 base::WeakPtrFactory<PasswordProtectionService> weak_factory_;
202 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService); 214 DISALLOW_COPY_AND_ASSIGN(PasswordProtectionService);
203 }; 215 };
204 216
205 } // namespace safe_browsing 217 } // namespace safe_browsing
206 218
207 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERV ICE_H_ 219 #endif // COMPONENTS_SAFE_BROWSING_PASSWORD_PROTECTION_PASSWORD_PROTECTION_SERV ICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698