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

Unified Diff: chrome/renderer/safe_browsing/phishing_classifier_delegate.h

Issue 6398001: Run pre-classification checks in the browser before starting client-side phishing detection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix switch/case formatting Created 9 years, 11 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_delegate.h
diff --git a/chrome/renderer/safe_browsing/phishing_classifier_delegate.h b/chrome/renderer/safe_browsing/phishing_classifier_delegate.h
index 9d171274b18775d4530fd4a101c9c13408f129cb..8cb663c9e62e932dcedcc675308955c0cea3057d 100644
--- a/chrome/renderer/safe_browsing/phishing_classifier_delegate.h
+++ b/chrome/renderer/safe_browsing/phishing_classifier_delegate.h
@@ -35,6 +35,13 @@ class PhishingClassifierDelegate {
// The scorer is passed on to the classifier.
void SetPhishingScorer(const safe_browsing::Scorer* scorer);
+ // Called by the RenderView when it receives a StartPhishingDetection IPC
+ // from the browser. This signals that it is ok to begin classification
+ // for the given toplevel URL. If the URL has been fully loaded into the
+ // RenderView and a Scorer has been set, this will begin classification,
+ // otherwise classification will be deferred until these conditions are met.
+ void OnStartPhishingDetection(const GURL& url);
+
// Called by the RenderView when a page has started loading in the given
// WebFrame. Typically, this will cause any pending classification to be
// cancelled. However, if the load is for the main frame, and the toplevel
@@ -60,6 +67,9 @@ class PhishingClassifierDelegate {
// Returns the RenderView's toplevel URL, with the ref stripped.
GURL StripToplevelUrl();
+ // Shared code to begin classification if all conditions are met.
+ void MaybeStartClassification();
+
// The RenderView that owns this object.
RenderView* render_view_;
@@ -67,24 +77,27 @@ class PhishingClassifierDelegate {
// a scorer is made available via SetPhishingScorer().
scoped_ptr<PhishingClassifier> classifier_;
- // The last URL that was sent to the phishing classifier.
- GURL last_url_sent_to_classifier_;
+ // The last URL that the browser instructed us to classify.
+ GURL last_url_received_from_browser_;
- // The page id of the last load that was sent to the phishing classifier.
- // This is used to suppress phishing classification on back and forward
- // navigations in history.
+ // The last URL and page id that have finished loading in the RenderView.
+ // These correspond to the text in classifier_page_text_.
+ GURL last_finished_load_url_;
+ int32 last_finished_load_id_;
+
+ // The URL and page id of the last load that we actually started
+ // classification on. This is used to suppress phishing classification on
+ // subframe navigation and back and forward navigations in history.
+ GURL last_url_sent_to_classifier_;
int32 last_page_id_sent_to_classifier_;
// The page text that will be analyzed by the phishing classifier. This is
// set by OnNavigate and cleared when the classifier finishes. Note that if
- // there is no classifier yet when OnNavigate is called, the page text will
- // be cached until the scorer is set and a classifier can be created.
+ // there is no Scorer yet when OnNavigate is called, or the browser has not
+ // instructed us to classify the page, the page text will be cached until
+ // these conditions are met.
string16 classifier_page_text_;
- // Set to true if we should run the phishing classifier on the current page
- // as soon as SetPhishingScorer() is called.
- bool pending_classification_;
-
DISALLOW_COPY_AND_ASSIGN(PhishingClassifierDelegate);
};

Powered by Google App Engine
This is Rietveld 408576698