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

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

Issue 14999008: Add a killswitch for CSD malware IP match and report feature. Use a new killswitch whitelist URL wh… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 7 years, 7 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 | Annotate | Revision Log
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 <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 DCHECK(browse_info_.get()); 373 DCHECK(browse_info_.get());
374 374
375 // We parse the protocol buffer here. If we're unable to parse it we won't 375 // We parse the protocol buffer here. If we're unable to parse it we won't
376 // send the verdict further. 376 // send the verdict further.
377 scoped_ptr<ClientPhishingRequest> verdict(new ClientPhishingRequest); 377 scoped_ptr<ClientPhishingRequest> verdict(new ClientPhishingRequest);
378 if (csd_service_ && 378 if (csd_service_ &&
379 !weak_factory_.HasWeakPtrs() && 379 !weak_factory_.HasWeakPtrs() &&
380 browse_info_.get() && 380 browse_info_.get() &&
381 verdict->ParseFromString(verdict_str) && 381 verdict->ParseFromString(verdict_str) &&
382 verdict->IsInitialized()) { 382 verdict->IsInitialized()) {
383 scoped_ptr<ClientMalwareRequest> malware_verdict(new ClientMalwareRequest); 383 // We do the malware IP matching and request sending if the feature
384 // Start browser-side malware feature extraction. Once we're done it will 384 // is enabled
385 // send the malware client verdict request. 385 if (database_manager_ && !database_manager_->MalwareKillSwitchOn()) {
386 malware_verdict->set_url(verdict->url()); 386 scoped_ptr<ClientMalwareRequest> malware_verdict(
387 feature_extractor_->ExtractMalwareFeatures( 387 new ClientMalwareRequest);
388 browse_info_.get(), 388 // Start browser-side malware feature extraction. Once we're done it will
389 malware_verdict.get()); 389 // send the malware client verdict request.
390 MalwareFeatureExtractionDone(malware_verdict.Pass()); 390 malware_verdict->set_url(verdict->url());
391 feature_extractor_->ExtractMalwareFeatures(
392 browse_info_.get(), malware_verdict.get());
393 MalwareFeatureExtractionDone(malware_verdict.Pass());
394 }
391 395
392 // We only send phishing verdict to the server if the verdict is phishing or 396 // We only send phishing verdict to the server if the verdict is phishing or
393 // if a SafeBrowsing interstitial was already shown for this site. E.g., a 397 // if a SafeBrowsing interstitial was already shown for this site. E.g., a
394 // malware or phishing interstitial was shown but the user clicked 398 // malware or phishing interstitial was shown but the user clicked
395 // through. 399 // through.
396 if (verdict->is_phishing() || DidShowSBInterstitial()) { 400 if (verdict->is_phishing() || DidShowSBInterstitial()) {
397 if (DidShowSBInterstitial()) { 401 if (DidShowSBInterstitial()) {
398 browse_info_->unsafe_resource.reset(unsafe_resource_.release()); 402 browse_info_->unsafe_resource.reset(unsafe_resource_.release());
399 } 403 }
400 // Start browser-side feature extraction. Once we're done it will send 404 // Start browser-side feature extraction. Once we're done it will send
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 ui_manager_->RemoveObserver(this); 534 ui_manager_->RemoveObserver(this);
531 535
532 ui_manager_ = ui_manager; 536 ui_manager_ = ui_manager;
533 if (ui_manager) 537 if (ui_manager)
534 ui_manager_->AddObserver(this); 538 ui_manager_->AddObserver(this);
535 539
536 database_manager_ = database_manager; 540 database_manager_ = database_manager;
537 } 541 }
538 542
539 } // namespace safe_browsing 543 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/database_manager.h » ('j') | chrome/browser/safe_browsing/database_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698