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

Side by Side Diff: chrome/browser/safe_browsing/ui_manager.h

Issue 2254103003: Permission Action Reporting: Bundle report data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review Comments Created 4 years, 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // The Safe Browsing service is responsible for downloading anti-phishing and 5 // The Safe Browsing service is responsible for downloading anti-phishing and
6 // anti-malware tables and checking urls against them. 6 // anti-malware tables and checking urls against them.
7 7
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_
9 #define CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ 9 #define CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "chrome/browser/permissions/permission_request.h"
20 #include "chrome/browser/permissions/permission_uma_util.h" 19 #include "chrome/browser/permissions/permission_uma_util.h"
21 #include "components/safe_browsing_db/hit_report.h" 20 #include "components/safe_browsing_db/hit_report.h"
22 #include "components/safe_browsing_db/util.h" 21 #include "components/safe_browsing_db/util.h"
23 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/permission_type.h" 23 #include "content/public/browser/permission_type.h"
25 #include "url/gurl.h" 24 #include "url/gurl.h"
26 25
27 namespace base { 26 namespace base {
28 class Thread; 27 class Thread;
29 } // namespace base 28 } // namespace base
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 virtual void MaybeReportSafeBrowsingHit( 150 virtual void MaybeReportSafeBrowsingHit(
152 const safe_browsing::HitReport& hit_report); 151 const safe_browsing::HitReport& hit_report);
153 152
154 // Report an invalid TLS/SSL certificate chain to the server. Can only 153 // Report an invalid TLS/SSL certificate chain to the server. Can only
155 // be called on UI thread. 154 // be called on UI thread.
156 void ReportInvalidCertificateChain(const std::string& serialized_report, 155 void ReportInvalidCertificateChain(const std::string& serialized_report,
157 const base::Closure& callback); 156 const base::Closure& callback);
158 157
159 // Report permission action to SafeBrowsing servers. Can only be called on UI 158 // Report permission action to SafeBrowsing servers. Can only be called on UI
160 // thread. 159 // thread.
161 void ReportPermissionAction(const GURL& origin, 160 void ReportPermissionAction(const PermissionReportInfo& report_info);
162 content::PermissionType permission,
163 PermissionAction action,
164 PermissionSourceUI source_ui,
165 PermissionRequestGestureType gesture_type,
166 int num_prior_dismissals,
167 int num_prior_ignores);
168 161
169 // Add and remove observers. These methods must be invoked on the UI thread. 162 // Add and remove observers. These methods must be invoked on the UI thread.
170 void AddObserver(Observer* observer); 163 void AddObserver(Observer* observer);
171 void RemoveObserver(Observer* remove); 164 void RemoveObserver(Observer* remove);
172 165
173 protected: 166 protected:
174 virtual ~SafeBrowsingUIManager(); 167 virtual ~SafeBrowsingUIManager();
175 168
176 private: 169 private:
177 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>; 170 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>;
178 friend class SafeBrowsingUIManagerTest; 171 friend class SafeBrowsingUIManagerTest;
179 friend class TestSafeBrowsingUIManager; 172 friend class TestSafeBrowsingUIManager;
180 173
181 // Call protocol manager on IO thread to report hits of unsafe contents. 174 // Call protocol manager on IO thread to report hits of unsafe contents.
182 void ReportSafeBrowsingHitOnIOThread( 175 void ReportSafeBrowsingHitOnIOThread(
183 const safe_browsing::HitReport& hit_report); 176 const safe_browsing::HitReport& hit_report);
184 177
185 // Sends an invalid certificate chain report over the network. 178 // Sends an invalid certificate chain report over the network.
186 void ReportInvalidCertificateChainOnIOThread( 179 void ReportInvalidCertificateChainOnIOThread(
187 const std::string& serialized_report); 180 const std::string& serialized_report);
188 181
189 // Report permission action to SafeBrowsing servers. 182 // Report permission action to SafeBrowsing servers.
190 void ReportPermissionActionOnIOThread( 183 void ReportPermissionActionOnIOThread(
191 const GURL& origin, 184 const PermissionReportInfo& report_info);
192 content::PermissionType permission,
193 PermissionAction action,
194 PermissionSourceUI source_ui,
195 PermissionRequestGestureType gesture_type,
196 int num_prior_dismissals,
197 int num_prior_ignores);
198 185
199 // Updates the whitelist state. Called on the UI thread. 186 // Updates the whitelist state. Called on the UI thread.
200 void AddToWhitelist(const UnsafeResource& resource); 187 void AddToWhitelist(const UnsafeResource& resource);
201 188
202 // Safebrowsing service. 189 // Safebrowsing service.
203 scoped_refptr<SafeBrowsingService> sb_service_; 190 scoped_refptr<SafeBrowsingService> sb_service_;
204 191
205 base::ObserverList<Observer> observer_list_; 192 base::ObserverList<Observer> observer_list_;
206 193
207 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); 194 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager);
208 }; 195 };
209 196
210 } // namespace safe_browsing 197 } // namespace safe_browsing
211 198
212 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ 199 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698