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

Unified Diff: chrome/browser/safe_browsing/ui_manager.cc

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: Remove a redundant include 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/ui_manager.cc
diff --git a/chrome/browser/safe_browsing/ui_manager.cc b/chrome/browser/safe_browsing/ui_manager.cc
index 80a38d0338e21359b4a371dad026f875f94799dc..48e6583d48a7fbaa09058a98b7e9c6231bec6d4e 100644
--- a/chrome/browser/safe_browsing/ui_manager.cc
+++ b/chrome/browser/safe_browsing/ui_manager.cc
@@ -281,6 +281,17 @@ void SafeBrowsingUIManager::ReportInvalidCertificateChain(
callback);
}
+void SafeBrowsingUIManager::ReportPermissionAction(
+ const GURL& origin,
+ content::PermissionType permission,
+ PermissionAction action) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
Nathan Parker 2016/06/16 21:08:41 nit: I'm not clear on why this _has_ to be on the
stefanocs 2016/06/17 00:42:08 I'm also not clear about this but the other two re
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&SafeBrowsingUIManager::ReportPermissionActionOnIOThread, this,
+ origin, permission, action));
+}
+
void SafeBrowsingUIManager::AddObserver(Observer* observer) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
observer_list_.AddObserver(observer);
@@ -303,6 +314,21 @@ void SafeBrowsingUIManager::ReportInvalidCertificateChainOnIOThread(
sb_service_->ping_manager()->ReportInvalidCertificateChain(serialized_report);
}
+void SafeBrowsingUIManager::ReportPermissionActionOnIOThread(
+ const GURL& origin,
+ content::PermissionType permission,
+ PermissionAction action) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ // The service may delete the ping manager (i.e. when user disabling service,
+ // etc). This happens on the IO thread.
+ if (!sb_service_ || !sb_service_->ping_manager())
+ return;
+
+ sb_service_->ping_manager()->ReportPermissionAction(origin, permission,
+ action);
+}
+
// If the user had opted-in to send ThreatDetails, this gets called
// when the report is ready.
void SafeBrowsingUIManager::SendSerializedThreatDetails(

Powered by Google App Engine
This is Rietveld 408576698