| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This class is used by the RenderView to interact with a PhishingClassifier. | 5 // This class is used by the RenderView to interact with a PhishingClassifier. |
| 6 | 6 |
| 7 #ifndef CHROME_RENDERER_SAFE_BROWSING_PHISHING_CLASSIFIER_DELEGATE_H_ | 7 #ifndef CHROME_RENDERER_SAFE_BROWSING_PHISHING_CLASSIFIER_DELEGATE_H_ |
| 8 #define CHROME_RENDERER_SAFE_BROWSING_PHISHING_CLASSIFIER_DELEGATE_H_ | 8 #define CHROME_RENDERER_SAFE_BROWSING_PHISHING_CLASSIFIER_DELEGATE_H_ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "content/common/page_transition_types.h" | 13 #include "content/public/common/page_transition_types.h" |
| 14 #include "content/public/renderer/render_process_observer.h" | 14 #include "content/public/renderer/render_process_observer.h" |
| 15 #include "content/public/renderer/render_view_observer.h" | 15 #include "content/public/renderer/render_view_observer.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 | 17 |
| 18 namespace safe_browsing { | 18 namespace safe_browsing { |
| 19 class ClientPhishingRequest; | 19 class ClientPhishingRequest; |
| 20 class PhishingClassifier; | 20 class PhishingClassifier; |
| 21 class Scorer; | 21 class Scorer; |
| 22 | 22 |
| 23 class PhishingClassifierFilter : public content::RenderProcessObserver { | 23 class PhishingClassifierFilter : public content::RenderProcessObserver { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 GURL last_url_received_from_browser_; | 109 GURL last_url_received_from_browser_; |
| 110 | 110 |
| 111 // The last top-level URL that has finished loading in the RenderView. | 111 // The last top-level URL that has finished loading in the RenderView. |
| 112 // This corresponds to the text in classifier_page_text_. | 112 // This corresponds to the text in classifier_page_text_. |
| 113 GURL last_finished_load_url_; | 113 GURL last_finished_load_url_; |
| 114 | 114 |
| 115 // The transition type for the last load in the main frame. We use this | 115 // The transition type for the last load in the main frame. We use this |
| 116 // to exclude back/forward loads from classification. Note that this is | 116 // to exclude back/forward loads from classification. Note that this is |
| 117 // set in DidCommitProvisionalLoad(); the transition is reset after this | 117 // set in DidCommitProvisionalLoad(); the transition is reset after this |
| 118 // call in the RenderView, so we need to save off the value. | 118 // call in the RenderView, so we need to save off the value. |
| 119 PageTransition::Type last_main_frame_transition_; | 119 content::PageTransition last_main_frame_transition_; |
| 120 | 120 |
| 121 // The URL of the last load that we actually started classification on. | 121 // The URL of the last load that we actually started classification on. |
| 122 // This is used to suppress phishing classification on subframe navigation | 122 // This is used to suppress phishing classification on subframe navigation |
| 123 // and back and forward navigations in history. | 123 // and back and forward navigations in history. |
| 124 GURL last_url_sent_to_classifier_; | 124 GURL last_url_sent_to_classifier_; |
| 125 | 125 |
| 126 // The page text that will be analyzed by the phishing classifier. This is | 126 // The page text that will be analyzed by the phishing classifier. This is |
| 127 // set by OnNavigate and cleared when the classifier finishes. Note that if | 127 // set by OnNavigate and cleared when the classifier finishes. Note that if |
| 128 // there is no Scorer yet when OnNavigate is called, or the browser has not | 128 // there is no Scorer yet when OnNavigate is called, or the browser has not |
| 129 // instructed us to classify the page, the page text will be cached until | 129 // instructed us to classify the page, the page text will be cached until |
| 130 // these conditions are met. | 130 // these conditions are met. |
| 131 string16 classifier_page_text_; | 131 string16 classifier_page_text_; |
| 132 | 132 |
| 133 // Tracks whether we have stored anything in classifier_page_text_ for the | 133 // Tracks whether we have stored anything in classifier_page_text_ for the |
| 134 // most recent load. We use this to distinguish empty text from cases where | 134 // most recent load. We use this to distinguish empty text from cases where |
| 135 // PageCaptured has not been called. | 135 // PageCaptured has not been called. |
| 136 bool have_page_text_; | 136 bool have_page_text_; |
| 137 | 137 |
| 138 // Set to true if the classifier is currently running. | 138 // Set to true if the classifier is currently running. |
| 139 bool is_classifying_; | 139 bool is_classifying_; |
| 140 | 140 |
| 141 DISALLOW_COPY_AND_ASSIGN(PhishingClassifierDelegate); | 141 DISALLOW_COPY_AND_ASSIGN(PhishingClassifierDelegate); |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 } // namespace safe_browsing | 144 } // namespace safe_browsing |
| 145 | 145 |
| 146 #endif // CHROME_RENDERER_SAFE_BROWSING_PHISHING_CLASSIFIER_DELEGATE_H_ | 146 #endif // CHROME_RENDERER_SAFE_BROWSING_PHISHING_CLASSIFIER_DELEGATE_H_ |
| OLD | NEW |