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

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

Issue 2150903002: Reland add hooks to permission layer for permission action reporting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 4 years, 5 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"
23 #include "content/public/browser/permission_type.h"
22 #include "url/gurl.h" 24 #include "url/gurl.h"
23 25
24 namespace base { 26 namespace base {
25 class Thread; 27 class Thread;
26 } // namespace base 28 } // namespace base
27 29
28 namespace content { 30 namespace content {
29 class NavigationEntry; 31 class NavigationEntry;
30 } // namespace content 32 } // namespace content
31 33
(...skipping 109 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. 143 // non-empty, the request will be sent as a POST instead of a GET.
142 // Will report only for UMA || is_extended_reporting. 144 // Will report only for UMA || is_extended_reporting.
143 virtual void MaybeReportSafeBrowsingHit( 145 virtual void MaybeReportSafeBrowsingHit(
144 const safe_browsing::HitReport& hit_report); 146 const safe_browsing::HitReport& hit_report);
145 147
146 // Report an invalid TLS/SSL certificate chain to the server. Can only 148 // Report an invalid TLS/SSL certificate chain to the server. Can only
147 // be called on UI thread. 149 // be called on UI thread.
148 void ReportInvalidCertificateChain(const std::string& serialized_report, 150 void ReportInvalidCertificateChain(const std::string& serialized_report,
149 const base::Closure& callback); 151 const base::Closure& callback);
150 152
153 // Report permission action to SafeBrowsing servers. Can only be called on UI
154 // thread.
155 void ReportPermissionAction(const GURL& origin,
156 content::PermissionType permission,
157 PermissionAction action);
158
151 // Add and remove observers. These methods must be invoked on the UI thread. 159 // Add and remove observers. These methods must be invoked on the UI thread.
152 void AddObserver(Observer* observer); 160 void AddObserver(Observer* observer);
153 void RemoveObserver(Observer* remove); 161 void RemoveObserver(Observer* remove);
154 162
155 protected: 163 protected:
156 virtual ~SafeBrowsingUIManager(); 164 virtual ~SafeBrowsingUIManager();
157 165
158 private: 166 private:
159 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>; 167 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>;
160 friend class SafeBrowsingUIManagerTest; 168 friend class SafeBrowsingUIManagerTest;
161 friend class TestSafeBrowsingUIManager; 169 friend class TestSafeBrowsingUIManager;
162 170
163 // Call protocol manager on IO thread to report hits of unsafe contents. 171 // Call protocol manager on IO thread to report hits of unsafe contents.
164 void ReportSafeBrowsingHitOnIOThread( 172 void ReportSafeBrowsingHitOnIOThread(
165 const safe_browsing::HitReport& hit_report); 173 const safe_browsing::HitReport& hit_report);
166 174
167 // Sends an invalid certificate chain report over the network. 175 // Sends an invalid certificate chain report over the network.
168 void ReportInvalidCertificateChainOnIOThread( 176 void ReportInvalidCertificateChainOnIOThread(
169 const std::string& serialized_report); 177 const std::string& serialized_report);
170 178
179 // Report permission action to SafeBrowsing servers.
180 void ReportPermissionActionOnIOThread(const GURL& origin,
181 content::PermissionType permission,
182 PermissionAction action);
183
171 // Updates the whitelist state. Called on the UI thread. 184 // Updates the whitelist state. Called on the UI thread.
172 void AddToWhitelist(const UnsafeResource& resource); 185 void AddToWhitelist(const UnsafeResource& resource);
173 186
174 // Safebrowsing service. 187 // Safebrowsing service.
175 scoped_refptr<SafeBrowsingService> sb_service_; 188 scoped_refptr<SafeBrowsingService> sb_service_;
176 189
177 base::ObserverList<Observer> observer_list_; 190 base::ObserverList<Observer> observer_list_;
178 191
179 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); 192 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager);
180 }; 193 };
181 194
182 } // namespace safe_browsing 195 } // namespace safe_browsing
183 196
184 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ 197 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/ping_manager.cc ('k') | chrome/browser/safe_browsing/ui_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698