| 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 15 matching lines...) Expand all Loading... |
| 26 ~NavigationEvent(); | 26 ~NavigationEvent(); |
| 27 | 27 |
| 28 GURL source_url; // URL that caused this navigation to occur. | 28 GURL source_url; // URL that caused this navigation to occur. |
| 29 // TODO(jialiul): source_url may be incorrect when | 29 // TODO(jialiul): source_url may be incorrect when |
| 30 // navigation involves frames targeting each other. | 30 // navigation involves frames targeting each other. |
| 31 // http://crbug.com/651895. | 31 // http://crbug.com/651895. |
| 32 GURL source_main_frame_url; // Main frame url of the source_url. Could be the | 32 GURL source_main_frame_url; // Main frame url of the source_url. Could be the |
| 33 // same as source_url, if source_url was loaded | 33 // same as source_url, if source_url was loaded |
| 34 // in main frame. | 34 // in main frame. |
| 35 GURL original_request_url; // The original request URL of this navigation. | 35 GURL original_request_url; // The original request URL of this navigation. |
| 36 GURL destination_url; // The actual destination url of this navigation | 36 std::vector<GURL> server_redirect_urls; // Server redirect url chain. |
| 37 // event. If this navigation has server side | 37 // Empty if there is no server |
| 38 // redirect(s), actual_target_url will be | 38 // redirect. If set, last url in this |
| 39 // different from initial_request_url. | 39 // vector is the destination url. |
| 40 int source_tab_id; // Which tab contains the frame with source_url. Tab ID is | 40 int source_tab_id; // Which tab contains the frame with source_url. Tab ID is |
| 41 // returned by SessionTabHelper::IdForTab. This ID is | 41 // returned by SessionTabHelper::IdForTab. This ID is |
| 42 // immutable for a given tab and unique across Chrome | 42 // immutable for a given tab and unique across Chrome |
| 43 // within the current session. | 43 // within the current session. |
| 44 int target_tab_id; // Which tab this request url is targeting to. | 44 int target_tab_id; // Which tab this request url is targeting to. |
| 45 int frame_id; // Frame tree node ID of the frame where this navigation takes | 45 int frame_id; // Frame tree node ID of the frame where this navigation takes |
| 46 // place. | 46 // place. |
| 47 base::Time last_updated; // When this NavigationEvent was last updated. | 47 base::Time last_updated; // When this NavigationEvent was last updated. |
| 48 bool is_user_initiated; // browser_initiated || has_user_gesture. | 48 bool is_user_initiated; // browser_initiated || has_user_gesture. |
| 49 bool has_committed; | 49 bool has_committed; |
| 50 bool has_server_redirect; | 50 |
| 51 const GURL& GetDestinationUrl() const { |
| 52 if (!server_redirect_urls.empty()) |
| 53 return server_redirect_urls.back(); |
| 54 else |
| 55 return original_request_url; |
| 56 } |
| 51 }; | 57 }; |
| 52 | 58 |
| 53 // Structure to keep track of resolved IP address of a host. | 59 // Structure to keep track of resolved IP address of a host. |
| 54 struct ResolvedIPAddress { | 60 struct ResolvedIPAddress { |
| 55 ResolvedIPAddress() : timestamp(base::Time::Now()), ip() {} | 61 ResolvedIPAddress() : timestamp(base::Time::Now()), ip() {} |
| 56 ResolvedIPAddress(base::Time timestamp, const std::string& ip) | 62 ResolvedIPAddress(base::Time timestamp, const std::string& ip) |
| 57 : timestamp(timestamp), ip(ip) {} | 63 : timestamp(timestamp), ip(ip) {} |
| 58 base::Time timestamp; // Timestamp of when we get the resolved IP. | 64 base::Time timestamp; // Timestamp of when we get the resolved IP. |
| 59 std::string ip; // Resolved IP address | 65 std::string ip; // Resolved IP address |
| 60 }; | 66 }; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 bool has_user_gesture_; | 112 bool has_user_gesture_; |
| 107 | 113 |
| 108 base::Time last_user_gesture_timestamp_; | 114 base::Time last_user_gesture_timestamp_; |
| 109 | 115 |
| 110 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingNavigationObserver); | 116 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingNavigationObserver); |
| 111 }; | 117 }; |
| 112 | 118 |
| 113 } // namespace safe_browsing | 119 } // namespace safe_browsing |
| 114 | 120 |
| 115 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_H_ | 121 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_H_ |
| OLD | NEW |