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

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

Issue 2178213003: Update RequestTrigger to GestureType in permission report (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolve nits 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"
19 #include "chrome/browser/permissions/permission_uma_util.h" 20 #include "chrome/browser/permissions/permission_uma_util.h"
20 #include "components/safe_browsing_db/hit_report.h" 21 #include "components/safe_browsing_db/hit_report.h"
21 #include "components/safe_browsing_db/util.h" 22 #include "components/safe_browsing_db/util.h"
22 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/permission_type.h" 24 #include "content/public/browser/permission_type.h"
24 #include "url/gurl.h" 25 #include "url/gurl.h"
25 26
26 namespace base { 27 namespace base {
27 class Thread; 28 class Thread;
28 } // namespace base 29 } // namespace base
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // be called on UI thread. 150 // be called on UI thread.
150 void ReportInvalidCertificateChain(const std::string& serialized_report, 151 void ReportInvalidCertificateChain(const std::string& serialized_report,
151 const base::Closure& callback); 152 const base::Closure& callback);
152 153
153 // Report permission action to SafeBrowsing servers. Can only be called on UI 154 // Report permission action to SafeBrowsing servers. Can only be called on UI
154 // thread. 155 // thread.
155 void ReportPermissionAction(const GURL& origin, 156 void ReportPermissionAction(const GURL& origin,
156 content::PermissionType permission, 157 content::PermissionType permission,
157 PermissionAction action, 158 PermissionAction action,
158 PermissionSourceUI source_ui, 159 PermissionSourceUI source_ui,
159 bool user_gesture); 160 PermissionRequestGestureType gesture_type);
160 161
161 // 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.
162 void AddObserver(Observer* observer); 163 void AddObserver(Observer* observer);
163 void RemoveObserver(Observer* remove); 164 void RemoveObserver(Observer* remove);
164 165
165 protected: 166 protected:
166 virtual ~SafeBrowsingUIManager(); 167 virtual ~SafeBrowsingUIManager();
167 168
168 private: 169 private:
169 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>; 170 friend class base::RefCountedThreadSafe<SafeBrowsingUIManager>;
170 friend class SafeBrowsingUIManagerTest; 171 friend class SafeBrowsingUIManagerTest;
171 friend class TestSafeBrowsingUIManager; 172 friend class TestSafeBrowsingUIManager;
172 173
173 // 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.
174 void ReportSafeBrowsingHitOnIOThread( 175 void ReportSafeBrowsingHitOnIOThread(
175 const safe_browsing::HitReport& hit_report); 176 const safe_browsing::HitReport& hit_report);
176 177
177 // Sends an invalid certificate chain report over the network. 178 // Sends an invalid certificate chain report over the network.
178 void ReportInvalidCertificateChainOnIOThread( 179 void ReportInvalidCertificateChainOnIOThread(
179 const std::string& serialized_report); 180 const std::string& serialized_report);
180 181
181 // Report permission action to SafeBrowsing servers. 182 // Report permission action to SafeBrowsing servers.
182 void ReportPermissionActionOnIOThread(const GURL& origin, 183 void ReportPermissionActionOnIOThread(
183 content::PermissionType permission, 184 const GURL& origin,
184 PermissionAction action, 185 content::PermissionType permission,
185 PermissionSourceUI source_ui, 186 PermissionAction action,
186 bool user_gesture); 187 PermissionSourceUI source_ui,
188 PermissionRequestGestureType gesture_type);
187 189
188 // Updates the whitelist state. Called on the UI thread. 190 // Updates the whitelist state. Called on the UI thread.
189 void AddToWhitelist(const UnsafeResource& resource); 191 void AddToWhitelist(const UnsafeResource& resource);
190 192
191 // Safebrowsing service. 193 // Safebrowsing service.
192 scoped_refptr<SafeBrowsingService> sb_service_; 194 scoped_refptr<SafeBrowsingService> sb_service_;
193 195
194 base::ObserverList<Observer> observer_list_; 196 base::ObserverList<Observer> observer_list_;
195 197
196 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager); 198 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingUIManager);
197 }; 199 };
198 200
199 } // namespace safe_browsing 201 } // namespace safe_browsing
200 202
201 #endif // CHROME_BROWSER_SAFE_BROWSING_UI_MANAGER_H_ 203 #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