OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_H_ |
6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_H_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_H_ |
7 | 7 |
8 #include "base/supports_user_data.h" | 8 #include "base/supports_user_data.h" |
9 #include "content/public/browser/web_contents_observer.h" | 9 #include "content/public/browser/web_contents_observer.h" |
10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 : timestamp(timestamp), ip(ip) {} | 57 : timestamp(timestamp), ip(ip) {} |
58 base::Time timestamp; // Timestamp of when we get the resolved IP. | 58 base::Time timestamp; // Timestamp of when we get the resolved IP. |
59 std::string ip; // Resolved IP address | 59 std::string ip; // Resolved IP address |
60 }; | 60 }; |
61 | 61 |
62 // Observes the navigation events for a single WebContents (both main-frame | 62 // Observes the navigation events for a single WebContents (both main-frame |
63 // and sub-frame navigations). | 63 // and sub-frame navigations). |
64 class SafeBrowsingNavigationObserver : public base::SupportsUserData::Data, | 64 class SafeBrowsingNavigationObserver : public base::SupportsUserData::Data, |
65 public content::WebContentsObserver { | 65 public content::WebContentsObserver { |
66 public: | 66 public: |
67 static void MaybeCreateForWebContents(content::WebContents* web_contents); | 67 static void CreateForWebContents( |
| 68 content::WebContents* web_contents, |
| 69 const scoped_refptr<SafeBrowsingNavigationObserverManager>& manager); |
| 70 |
68 static SafeBrowsingNavigationObserver* FromWebContents( | 71 static SafeBrowsingNavigationObserver* FromWebContents( |
69 content::WebContents* web_contents); | 72 content::WebContents* web_contents); |
70 | 73 |
71 SafeBrowsingNavigationObserver( | 74 SafeBrowsingNavigationObserver( |
72 content::WebContents* contents, | 75 content::WebContents* contents, |
73 const scoped_refptr<SafeBrowsingNavigationObserverManager>& manager); | 76 const scoped_refptr<SafeBrowsingNavigationObserverManager>& manager); |
74 | 77 |
75 ~SafeBrowsingNavigationObserver() override; | 78 ~SafeBrowsingNavigationObserver() override; |
76 | 79 |
77 private: | 80 private: |
(...skipping 26 matching lines...) Expand all Loading... |
104 bool has_user_gesture_; | 107 bool has_user_gesture_; |
105 | 108 |
106 base::Time last_user_gesture_timestamp_; | 109 base::Time last_user_gesture_timestamp_; |
107 | 110 |
108 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingNavigationObserver); | 111 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingNavigationObserver); |
109 }; | 112 }; |
110 | 113 |
111 } // namespace safe_browsing | 114 } // namespace safe_browsing |
112 | 115 |
113 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_H_ | 116 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_H_ |
OLD | NEW |