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

Unified Diff: chrome/renderer/safe_browsing/phishing_classifier.cc

Issue 8310014: Only send the client-side phishing model to a renderer if its profile has SafeBrowsing enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a comment as Noe suggested Created 9 years, 2 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/renderer/safe_browsing/phishing_classifier.cc
diff --git a/chrome/renderer/safe_browsing/phishing_classifier.cc b/chrome/renderer/safe_browsing/phishing_classifier.cc
index 1fa068eecd1470892e4687e9a6f7902be3c5eba2..2c5f70a5017ddb96d281cf076a7315c5227eecbb 100644
--- a/chrome/renderer/safe_browsing/phishing_classifier.cc
+++ b/chrome/renderer/safe_browsing/phishing_classifier.cc
@@ -53,15 +53,23 @@ PhishingClassifier::~PhishingClassifier() {
void PhishingClassifier::set_phishing_scorer(const Scorer* scorer) {
CheckNoPendingClassification();
scorer_ = scorer;
- url_extractor_.reset(new PhishingUrlFeatureExtractor);
- dom_extractor_.reset(
- new PhishingDOMFeatureExtractor(render_view_, clock_.get()));
- term_extractor_.reset(new PhishingTermFeatureExtractor(
- &scorer_->page_terms(),
- &scorer_->page_words(),
- scorer_->max_words_per_term(),
- scorer_->murmurhash3_seed(),
- clock_.get()));
+ if (scorer_) {
+ url_extractor_.reset(new PhishingUrlFeatureExtractor);
+ dom_extractor_.reset(
+ new PhishingDOMFeatureExtractor(render_view_, clock_.get()));
+ term_extractor_.reset(new PhishingTermFeatureExtractor(
+ &scorer_->page_terms(),
+ &scorer_->page_words(),
+ scorer_->max_words_per_term(),
+ scorer_->murmurhash3_seed(),
+ clock_.get()));
+ } else {
+ // We're disabling client-side phishing detection, so tear down all
+ // of the relevant objects.
+ url_extractor_.reset();
+ dom_extractor_.reset();
+ term_extractor_.reset();
+ }
}
bool PhishingClassifier::is_ready() const {
« no previous file with comments | « chrome/common/safe_browsing/safebrowsing_messages.h ('k') | chrome/renderer/safe_browsing/phishing_classifier_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698