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

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

Issue 2047253002: Add hooks to permission layer for permission action reporting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-reporter-implementation
Patch Set: Small comment change Created 4 years, 6 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_uma_util.h"
19 #include "components/safe_browsing_db/hit_report.h" 20 #include "components/safe_browsing_db/hit_report.h"
20 #include "components/safe_browsing_db/util.h" 21 #include "components/safe_browsing_db/util.h"
21 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
22 #include "url/gurl.h" 23 #include "url/gurl.h"
23 24
24 namespace base { 25 namespace base {
25 class Thread; 26 class Thread;
26 } // namespace base 27 } // namespace base
27 28
28 namespace content { 29 namespace content {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // non-empty, the request will be sent as a POST instead of a GET. 142 // non-empty, the request will be sent as a POST instead of a GET.
142 // Will report only for UMA || is_extended_reporting. 143 // Will report only for UMA || is_extended_reporting.
143 virtual void MaybeReportSafeBrowsingHit( 144 virtual void MaybeReportSafeBrowsingHit(
144 const safe_browsing::HitReport& hit_report); 145 const safe_browsing::HitReport& hit_report);
145 146
146 // Report an invalid TLS/SSL certificate chain to the server. Can only 147 // Report an invalid TLS/SSL certificate chain to the server. Can only
147 // be called on UI thread. 148 // be called on UI thread.
148 void ReportInvalidCertificateChain(const std::string& serialized_report, 149 void ReportInvalidCertificateChain(const std::string& serialized_report,
149 const base::Closure& callback); 150 const base::Closure& callback);
150 151
152 // Report permission action to SafeBrowsing servers. Can only be called on UI
153 // thread.
154 void ReportPermissionAction(const GURL& origin,
155 content::PermissionType permission,
raymes 2016/06/16 01:10:23 nit: we need to include permission_type.h too
156 PermissionAction action);
157
151 // Add and remove observers. These methods must be invoked on the UI thread. 158 // Add and remove observers. These methods must be invoked on the UI thread.
152 void AddObserver(Observer* observer); 159 void AddObserver(Observer* observer);
153 void RemoveObserver(Observer* remove); 160 void RemoveObserver(Observer* remove);
154 161
155 protected: 162 protected:
156 virtual ~SafeBrowsingUIManager(); 163 virtual ~SafeBrowsingUIManager();
157 164
158 private: 165 private:
159 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>; 166 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>;
160 friend class SafeBrowsingUIManagerTest; 167 friend class SafeBrowsingUIManagerTest;
161 friend class TestSafeBrowsingUIManager; 168 friend class TestSafeBrowsingUIManager;
162 169
163 // Call protocol manager on IO thread to report hits of unsafe contents. 170 // Call protocol manager on IO thread to report hits of unsafe contents.
164 void ReportSafeBrowsingHitOnIOThread( 171 void ReportSafeBrowsingHitOnIOThread(
165 const safe_browsing::HitReport& hit_report); 172 const safe_browsing::HitReport& hit_report);
166 173
167 // Sends an invalid certificate chain report over the network. 174 // Sends an invalid certificate chain report over the network.
168 void ReportInvalidCertificateChainOnIOThread( 175 void ReportInvalidCertificateChainOnIOThread(
169 const std::string& serialized_report); 176 const std::string& serialized_report);
170 177
178 // Report permission action to SafeBrowsing servers.
179 void ReportPermissionActionOnIOThread(const GURL& origin,
180 content::PermissionType permission,
181 PermissionAction action);
182
171 // Updates the whitelist state. Called on the UI thread. 183 // Updates the whitelist state. Called on the UI thread.
172 void AddToWhitelist(const UnsafeResource& resource); 184 void AddToWhitelist(const UnsafeResource& resource);
173 185
174 // Safebrowsing service. 186 // Safebrowsing service.
175 scoped_refptr<SafeBrowsingService> sb_service_; 187 scoped_refptr<SafeBrowsingService> sb_service_;
176 188
177 base::ObserverList<Observer> observer_list_; 189 base::ObserverList<Observer> observer_list_;
178 190
179 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); 191 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager);
180 }; 192 };
181 193
182 } // namespace safe_browsing 194 } // namespace safe_browsing
183 195
184 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ 196 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698