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