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

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

Issue 2250893002: Permission Action Reporting: Add num_prior_* fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@par-new-fields-proto
Patch Set: Also update browsertest 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 #include "chrome/browser/safe_browsing/ui_manager.h" 5 #include "chrome/browser/safe_browsing/ui_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/debug/leak_tracker.h" 10 #include "base/debug/leak_tracker.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 &SafeBrowsingUIManager::ReportInvalidCertificateChainOnIOThread, this, 278 &SafeBrowsingUIManager::ReportInvalidCertificateChainOnIOThread, this,
279 serialized_report), 279 serialized_report),
280 callback); 280 callback);
281 } 281 }
282 282
283 void SafeBrowsingUIManager::ReportPermissionAction( 283 void SafeBrowsingUIManager::ReportPermissionAction(
284 const GURL& origin, 284 const GURL& origin,
285 content::PermissionType permission, 285 content::PermissionType permission,
286 PermissionAction action, 286 PermissionAction action,
287 PermissionSourceUI source_ui, 287 PermissionSourceUI source_ui,
288 PermissionRequestGestureType gesture_type) { 288 PermissionRequestGestureType gesture_type,
289 int num_prior_dismissals,
290 int num_prior_ignores) {
289 DCHECK_CURRENTLY_ON(BrowserThread::UI); 291 DCHECK_CURRENTLY_ON(BrowserThread::UI);
290 BrowserThread::PostTask( 292 BrowserThread::PostTask(
291 BrowserThread::IO, FROM_HERE, 293 BrowserThread::IO, FROM_HERE,
292 base::Bind(&SafeBrowsingUIManager::ReportPermissionActionOnIOThread, this, 294 base::Bind(&SafeBrowsingUIManager::ReportPermissionActionOnIOThread, this,
293 origin, permission, action, source_ui, gesture_type)); 295 origin, permission, action, source_ui, gesture_type,
296 num_prior_dismissals, num_prior_ignores));
294 } 297 }
295 298
296 void SafeBrowsingUIManager::AddObserver(Observer* observer) { 299 void SafeBrowsingUIManager::AddObserver(Observer* observer) {
297 DCHECK_CURRENTLY_ON(BrowserThread::UI); 300 DCHECK_CURRENTLY_ON(BrowserThread::UI);
298 observer_list_.AddObserver(observer); 301 observer_list_.AddObserver(observer);
299 } 302 }
300 303
301 void SafeBrowsingUIManager::RemoveObserver(Observer* observer) { 304 void SafeBrowsingUIManager::RemoveObserver(Observer* observer) {
302 DCHECK_CURRENTLY_ON(BrowserThread::UI); 305 DCHECK_CURRENTLY_ON(BrowserThread::UI);
303 observer_list_.RemoveObserver(observer); 306 observer_list_.RemoveObserver(observer);
304 } 307 }
305 308
306 void SafeBrowsingUIManager::ReportInvalidCertificateChainOnIOThread( 309 void SafeBrowsingUIManager::ReportInvalidCertificateChainOnIOThread(
307 const std::string& serialized_report) { 310 const std::string& serialized_report) {
308 DCHECK_CURRENTLY_ON(BrowserThread::IO); 311 DCHECK_CURRENTLY_ON(BrowserThread::IO);
309 312
310 // The service may delete the ping manager (i.e. when user disabling service, 313 // The service may delete the ping manager (i.e. when user disabling service,
311 // etc). This happens on the IO thread. 314 // etc). This happens on the IO thread.
312 if (!sb_service_ || !sb_service_->ping_manager()) 315 if (!sb_service_ || !sb_service_->ping_manager())
313 return; 316 return;
314 317
315 sb_service_->ping_manager()->ReportInvalidCertificateChain(serialized_report); 318 sb_service_->ping_manager()->ReportInvalidCertificateChain(serialized_report);
316 } 319 }
317 320
318 void SafeBrowsingUIManager::ReportPermissionActionOnIOThread( 321 void SafeBrowsingUIManager::ReportPermissionActionOnIOThread(
319 const GURL& origin, 322 const GURL& origin,
320 content::PermissionType permission, 323 content::PermissionType permission,
321 PermissionAction action, 324 PermissionAction action,
322 PermissionSourceUI source_ui, 325 PermissionSourceUI source_ui,
323 PermissionRequestGestureType gesture_type) { 326 PermissionRequestGestureType gesture_type,
327 int num_prior_dismissals,
328 int num_prior_ignores) {
324 DCHECK_CURRENTLY_ON(BrowserThread::IO); 329 DCHECK_CURRENTLY_ON(BrowserThread::IO);
325 330
326 // The service may delete the ping manager (i.e. when user disabling service, 331 // The service may delete the ping manager (i.e. when user disabling service,
327 // etc). This happens on the IO thread. 332 // etc). This happens on the IO thread.
328 if (!sb_service_ || !sb_service_->ping_manager()) 333 if (!sb_service_ || !sb_service_->ping_manager())
329 return; 334 return;
330 335
331 sb_service_->ping_manager()->ReportPermissionAction( 336 sb_service_->ping_manager()->ReportPermissionAction(
332 origin, permission, action, source_ui, gesture_type); 337 origin, permission, action, source_ui, gesture_type, num_prior_dismissals,
338 num_prior_ignores);
333 } 339 }
334 340
335 // If the user had opted-in to send ThreatDetails, this gets called 341 // If the user had opted-in to send ThreatDetails, this gets called
336 // when the report is ready. 342 // when the report is ready.
337 void SafeBrowsingUIManager::SendSerializedThreatDetails( 343 void SafeBrowsingUIManager::SendSerializedThreatDetails(
338 const std::string& serialized) { 344 const std::string& serialized) {
339 DCHECK_CURRENTLY_ON(BrowserThread::IO); 345 DCHECK_CURRENTLY_ON(BrowserThread::IO);
340 346
341 // The service may delete the ping manager (i.e. when user disabling service, 347 // The service may delete the ping manager (i.e. when user disabling service,
342 // etc). This happens on the IO thread. 348 // etc). This happens on the IO thread.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 400 }
395 401
396 WhitelistUrlSet* site_list = 402 WhitelistUrlSet* site_list =
397 static_cast<WhitelistUrlSet*>(web_contents->GetUserData(kWhitelistKey)); 403 static_cast<WhitelistUrlSet*>(web_contents->GetUserData(kWhitelistKey));
398 if (!site_list) 404 if (!site_list)
399 return false; 405 return false;
400 return site_list->Contains(maybe_whitelisted_url); 406 return site_list->Contains(maybe_whitelisted_url);
401 } 407 }
402 408
403 } // namespace safe_browsing 409 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698