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

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

Issue 2821193005: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/safe_browsing (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 (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/client_side_detection_host.h" 5 #include "chrome/browser/safe_browsing/client_side_detection_host.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 DontClassifyForMalware(NO_CLASSIFY_OFF_THE_RECORD); 126 DontClassifyForMalware(NO_CLASSIFY_OFF_THE_RECORD);
127 } 127 }
128 128
129 // We lookup the csd-whitelist before we lookup the cache because 129 // We lookup the csd-whitelist before we lookup the cache because
130 // a URL may have recently been whitelisted. If the URL matches 130 // a URL may have recently been whitelisted. If the URL matches
131 // the csd-whitelist we won't start phishing classification. The 131 // the csd-whitelist we won't start phishing classification. The
132 // csd-whitelist check has to be done on the IO thread because it 132 // csd-whitelist check has to be done on the IO thread because it
133 // uses the SafeBrowsing service class. 133 // uses the SafeBrowsing service class.
134 if (ShouldClassifyForPhishing() || ShouldClassifyForMalware()) { 134 if (ShouldClassifyForPhishing() || ShouldClassifyForMalware()) {
135 BrowserThread::PostTask( 135 BrowserThread::PostTask(
136 BrowserThread::IO, 136 BrowserThread::IO, FROM_HERE,
137 FROM_HERE, 137 base::BindOnce(&ShouldClassifyUrlRequest::CheckSafeBrowsingDatabase,
138 base::Bind(&ShouldClassifyUrlRequest::CheckSafeBrowsingDatabase, 138 this, url_));
139 this, url_));
140 } 139 }
141 } 140 }
142 141
143 void Cancel() { 142 void Cancel() {
144 DontClassifyForPhishing(NO_CLASSIFY_CANCEL); 143 DontClassifyForPhishing(NO_CLASSIFY_CANCEL);
145 DontClassifyForMalware(NO_CLASSIFY_CANCEL); 144 DontClassifyForMalware(NO_CLASSIFY_CANCEL);
146 // Just to make sure we don't do anything stupid we reset all these 145 // Just to make sure we don't do anything stupid we reset all these
147 // pointers except for the safebrowsing service class which may be 146 // pointers except for the safebrowsing service class which may be
148 // accessed by CheckSafeBrowsingDatabase(). 147 // accessed by CheckSafeBrowsingDatabase().
149 web_contents_ = NULL; 148 web_contents_ = NULL;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 if (database_manager_->MatchCsdWhitelistUrl(url)) { 225 if (database_manager_->MatchCsdWhitelistUrl(url)) {
227 DVLOG(1) << "Skipping phishing classification for URL: " << url 226 DVLOG(1) << "Skipping phishing classification for URL: " << url
228 << " because it matches the csd whitelist"; 227 << " because it matches the csd whitelist";
229 phishing_reason = NO_CLASSIFY_MATCH_CSD_WHITELIST; 228 phishing_reason = NO_CLASSIFY_MATCH_CSD_WHITELIST;
230 } 229 }
231 if (database_manager_->IsMalwareKillSwitchOn()) { 230 if (database_manager_->IsMalwareKillSwitchOn()) {
232 malware_reason = NO_CLASSIFY_KILLSWITCH; 231 malware_reason = NO_CLASSIFY_KILLSWITCH;
233 } 232 }
234 } 233 }
235 BrowserThread::PostTask( 234 BrowserThread::PostTask(
236 BrowserThread::UI, 235 BrowserThread::UI, FROM_HERE,
237 FROM_HERE, 236 base::BindOnce(&ShouldClassifyUrlRequest::CheckCache, this,
238 base::Bind(&ShouldClassifyUrlRequest::CheckCache, 237 phishing_reason, malware_reason));
239 this,
240 phishing_reason,
241 malware_reason));
242 } 238 }
243 239
244 void CheckCache(PreClassificationCheckFailures phishing_reason, 240 void CheckCache(PreClassificationCheckFailures phishing_reason,
245 PreClassificationCheckFailures malware_reason) { 241 PreClassificationCheckFailures malware_reason) {
246 DCHECK_CURRENTLY_ON(BrowserThread::UI); 242 DCHECK_CURRENTLY_ON(BrowserThread::UI);
247 if (phishing_reason != NO_CLASSIFY_MAX) 243 if (phishing_reason != NO_CLASSIFY_MAX)
248 DontClassifyForPhishing(phishing_reason); 244 DontClassifyForPhishing(phishing_reason);
249 if (malware_reason != NO_CLASSIFY_MAX) 245 if (malware_reason != NO_CLASSIFY_MAX)
250 DontClassifyForMalware(malware_reason); 246 DontClassifyForMalware(malware_reason);
251 if (!ShouldClassifyForMalware() && !ShouldClassifyForPhishing()) { 247 if (!ShouldClassifyForMalware() && !ShouldClassifyForPhishing()) {
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 ui_manager_->RemoveObserver(this); 721 ui_manager_->RemoveObserver(this);
726 722
727 ui_manager_ = ui_manager; 723 ui_manager_ = ui_manager;
728 if (ui_manager) 724 if (ui_manager)
729 ui_manager_->AddObserver(this); 725 ui_manager_->AddObserver(this);
730 726
731 database_manager_ = database_manager; 727 database_manager_ = database_manager;
732 } 728 }
733 729
734 } // namespace safe_browsing 730 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698