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

Side by Side Diff: chrome/browser/permissions/permission_blacklist_client.cc

Issue 2828663002: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/{i,l,m,n,p,r}* (Closed)
Patch Set: Created 3 years, 8 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/permissions/permission_blacklist_client.h" 5 #include "chrome/browser/permissions/permission_blacklist_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 30 matching lines...) Expand all
41 : content::WebContentsObserver(web_contents), 41 : content::WebContentsObserver(web_contents),
42 db_manager_(db_manager), 42 db_manager_(db_manager),
43 content_settings_type_(content_settings_type), 43 content_settings_type_(content_settings_type),
44 callback_(callback), 44 callback_(callback),
45 timeout_(timeout), 45 timeout_(timeout),
46 is_active_(true) { 46 is_active_(true) {
47 // Balanced by a call to Release() in EvaluateBlacklistResultOnUiThread(). 47 // Balanced by a call to Release() in EvaluateBlacklistResultOnUiThread().
48 AddRef(); 48 AddRef();
49 content::BrowserThread::PostTask( 49 content::BrowserThread::PostTask(
50 content::BrowserThread::IO, FROM_HERE, 50 content::BrowserThread::IO, FROM_HERE,
51 base::Bind(&PermissionBlacklistClient::StartCheck, this, request_origin)); 51 base::BindOnce(&PermissionBlacklistClient::StartCheck, this,
52 request_origin));
52 } 53 }
53 54
54 PermissionBlacklistClient::~PermissionBlacklistClient() {} 55 PermissionBlacklistClient::~PermissionBlacklistClient() {}
55 56
56 void PermissionBlacklistClient::StartCheck(const GURL& request_origin) { 57 void PermissionBlacklistClient::StartCheck(const GURL& request_origin) {
57 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 58 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
58 59
59 // Start the timer to interrupt into the client callback method with an 60 // Start the timer to interrupt into the client callback method with an
60 // empty response if Safe Browsing times out. 61 // empty response if Safe Browsing times out.
61 safe_browsing::ThreatMetadata empty_metadata; 62 safe_browsing::ThreatMetadata empty_metadata;
(...skipping 28 matching lines...) Expand all
90 bool permission_blocked = 91 bool permission_blocked =
91 metadata.api_permissions.find( 92 metadata.api_permissions.find(
92 PermissionUtil::ConvertContentSettingsTypeToSafeBrowsingName( 93 PermissionUtil::ConvertContentSettingsTypeToSafeBrowsingName(
93 content_settings_type_)) != metadata.api_permissions.end(); 94 content_settings_type_)) != metadata.api_permissions.end();
94 if (permission_blocked) 95 if (permission_blocked)
95 response = SafeBrowsingResponse::BLACKLISTED; 96 response = SafeBrowsingResponse::BLACKLISTED;
96 97
97 PermissionUmaUtil::RecordSafeBrowsingResponse(response_time, response); 98 PermissionUmaUtil::RecordSafeBrowsingResponse(response_time, response);
98 content::BrowserThread::PostTask( 99 content::BrowserThread::PostTask(
99 content::BrowserThread::UI, FROM_HERE, 100 content::BrowserThread::UI, FROM_HERE,
100 base::Bind(&PermissionBlacklistClient::EvaluateBlacklistResultOnUiThread, 101 base::BindOnce(
101 this, permission_blocked)); 102 &PermissionBlacklistClient::EvaluateBlacklistResultOnUiThread, this,
103 permission_blocked));
102 } 104 }
103 105
104 void PermissionBlacklistClient::EvaluateBlacklistResultOnUiThread( 106 void PermissionBlacklistClient::EvaluateBlacklistResultOnUiThread(
105 bool response) { 107 bool response) {
106 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 108 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
107 109
108 if (is_active_) 110 if (is_active_)
109 callback_.Run(response); 111 callback_.Run(response);
110 Release(); 112 Release();
111 } 113 }
112 114
113 void PermissionBlacklistClient::WebContentsDestroyed() { 115 void PermissionBlacklistClient::WebContentsDestroyed() {
114 is_active_ = false; 116 is_active_ = false;
115 Observe(nullptr); 117 Observe(nullptr);
116 } 118 }
OLDNEW
« no previous file with comments | « chrome/browser/performance_monitor/performance_monitor.cc ('k') | chrome/browser/permissions/permission_request_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698