| 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_MANAGER_H
_ | 5 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_MANAGER_H
_ |
| 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_MANAGER_H
_ | 6 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_MANAGER_H
_ |
| 7 | 7 |
| 8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
| 9 #include "base/supports_user_data.h" | 9 #include "base/supports_user_data.h" |
| 10 #include "chrome/common/safe_browsing/csd.pb.h" | 10 #include "chrome/common/safe_browsing/csd.pb.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // Based on the |initiating_frame_url| and its associated |tab_id|, trace back | 111 // Based on the |initiating_frame_url| and its associated |tab_id|, trace back |
| 112 // the observed NavigationEvents in navigation_map_ to identify the sequence | 112 // the observed NavigationEvents in navigation_map_ to identify the sequence |
| 113 // of navigations leading to this |initiating_frame_url|. If this initiating | 113 // of navigations leading to this |initiating_frame_url|. If this initiating |
| 114 // frame has a user gesture, we trace back with the coverage limited to | 114 // frame has a user gesture, we trace back with the coverage limited to |
| 115 // |user_gesture_count_limit|-1 number of user gestures, otherwise we trace | 115 // |user_gesture_count_limit|-1 number of user gestures, otherwise we trace |
| 116 // back |user_gesture_count_limit| number of user gestures. We then convert | 116 // back |user_gesture_count_limit| number of user gestures. We then convert |
| 117 // these identified NavigationEvents into ReferrerChainEntrys and append them | 117 // these identified NavigationEvents into ReferrerChainEntrys and append them |
| 118 // to |out_referrer_chain|. | 118 // to |out_referrer_chain|. |
| 119 AttributionResult IdentifyReferrerChainForPPAPIDownload( | 119 AttributionResult IdentifyReferrerChainForPPAPIDownload( |
| 120 const GURL& initiating_frame_url, | 120 const GURL& initiating_frame_url, |
| 121 const GURL& initiating_main_frame_url, |
| 121 int tab_id, | 122 int tab_id, |
| 122 bool has_user_gesture, | 123 bool has_user_gesture, |
| 123 int user_gesture_count_limit, | 124 int user_gesture_count_limit, |
| 124 ReferrerChain* out_referrer_chain); | 125 ReferrerChain* out_referrer_chain); |
| 125 | 126 |
| 126 private: | 127 private: |
| 127 friend class base::RefCountedThreadSafe< | 128 friend class base::RefCountedThreadSafe< |
| 128 SafeBrowsingNavigationObserverManager>; | 129 SafeBrowsingNavigationObserverManager>; |
| 129 friend class TestNavigationObserverManager; | 130 friend class TestNavigationObserverManager; |
| 130 friend class SBNavigationObserverBrowserTest; | 131 friend class SBNavigationObserverBrowserTest; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 // In this case, FindNavigationEvent() will think url2 in Window B is the | 192 // In this case, FindNavigationEvent() will think url2 in Window B is the |
| 192 // referrer of about::blank in Window C since this navigation is more recent. | 193 // referrer of about::blank in Window C since this navigation is more recent. |
| 193 // However, it does not prevent us to attribute url1 in Window A as the cause | 194 // However, it does not prevent us to attribute url1 in Window A as the cause |
| 194 // of all these navigations. | 195 // of all these navigations. |
| 195 NavigationEvent* FindNavigationEvent(const GURL& target_url, | 196 NavigationEvent* FindNavigationEvent(const GURL& target_url, |
| 196 const GURL& target_main_frame_url, | 197 const GURL& target_main_frame_url, |
| 197 int target_tab_id); | 198 int target_tab_id); |
| 198 | 199 |
| 199 void AddToReferrerChain(ReferrerChain* referrer_chain, | 200 void AddToReferrerChain(ReferrerChain* referrer_chain, |
| 200 NavigationEvent* nav_event, | 201 NavigationEvent* nav_event, |
| 202 const GURL& destination_main_frame_url, |
| 201 ReferrerChainEntry::URLType type); | 203 ReferrerChainEntry::URLType type); |
| 202 | 204 |
| 203 // Helper function to get the remaining referrer chain when we've already | 205 // Helper function to get the remaining referrer chain when we've already |
| 204 // traced back |current_user_gesture_count| number of user gestures. | 206 // traced back |current_user_gesture_count| number of user gestures. |
| 205 // This function modifies the |out_referrer_chain| and |out_result|. | 207 // This function modifies the |out_referrer_chain| and |out_result|. |
| 206 void GetRemainingReferrerChain(NavigationEvent* last_nav_event_traced, | 208 void GetRemainingReferrerChain(NavigationEvent* last_nav_event_traced, |
| 207 int current_user_gesture_count, | 209 int current_user_gesture_count, |
| 208 int user_gesture_count_limit, | 210 int user_gesture_count_limit, |
| 209 ReferrerChain* out_referrer_chain, | 211 ReferrerChain* out_referrer_chain, |
| 210 AttributionResult* out_result); | 212 AttributionResult* out_result); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 233 | 235 |
| 234 content::NotificationRegistrar registrar_; | 236 content::NotificationRegistrar registrar_; |
| 235 | 237 |
| 236 base::OneShotTimer cleanup_timer_; | 238 base::OneShotTimer cleanup_timer_; |
| 237 | 239 |
| 238 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingNavigationObserverManager); | 240 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingNavigationObserverManager); |
| 239 }; | 241 }; |
| 240 } // namespace safe_browsing | 242 } // namespace safe_browsing |
| 241 | 243 |
| 242 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_MANAGE
R_H_ | 244 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_MANAGE
R_H_ |
| OLD | NEW |