| 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 "chrome/common/safe_browsing/csd.pb.h" | 9 #include "chrome/common/safe_browsing/csd.pb.h" |
| 10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Based on the |initiating_frame_url| and its associated |tab_id|, trace back | 96 // Based on the |initiating_frame_url| and its associated |tab_id|, trace back |
| 97 // the observed NavigationEvents in navigation_map_ to identify the sequence | 97 // the observed NavigationEvents in navigation_map_ to identify the sequence |
| 98 // of navigations leading to this |initiating_frame_url|. If this initiating | 98 // of navigations leading to this |initiating_frame_url|. If this initiating |
| 99 // frame has a user gesture, we trace back with the coverage limited to | 99 // frame has a user gesture, we trace back with the coverage limited to |
| 100 // |user_gesture_count_limit|-1 number of user gestures, otherwise we trace | 100 // |user_gesture_count_limit|-1 number of user gestures, otherwise we trace |
| 101 // back |user_gesture_count_limit| number of user gestures. We then convert | 101 // back |user_gesture_count_limit| number of user gestures. We then convert |
| 102 // these identified NavigationEvents into ReferrerChainEntrys and append them | 102 // these identified NavigationEvents into ReferrerChainEntrys and append them |
| 103 // to |out_referrer_chain|. | 103 // to |out_referrer_chain|. |
| 104 AttributionResult IdentifyReferrerChainForPPAPIDownload( | 104 AttributionResult IdentifyReferrerChainForPPAPIDownload( |
| 105 const GURL& initiating_frame_url, | 105 const GURL& initiating_frame_url, |
| 106 const GURL& initiating_main_frame_url, |
| 106 int tab_id, | 107 int tab_id, |
| 107 bool has_user_gesture, | 108 bool has_user_gesture, |
| 108 int user_gesture_count_limit, | 109 int user_gesture_count_limit, |
| 109 ReferrerChain* out_referrer_chain); | 110 ReferrerChain* out_referrer_chain); |
| 110 | 111 |
| 111 private: | 112 private: |
| 112 friend class base::RefCountedThreadSafe< | 113 friend class base::RefCountedThreadSafe< |
| 113 SafeBrowsingNavigationObserverManager>; | 114 SafeBrowsingNavigationObserverManager>; |
| 114 friend class TestNavigationObserverManager; | 115 friend class TestNavigationObserverManager; |
| 115 friend class SBNavigationObserverBrowserTest; | 116 friend class SBNavigationObserverBrowserTest; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // In this case, FindNavigationEvent() will think url2 in Window B is the | 177 // In this case, FindNavigationEvent() will think url2 in Window B is the |
| 177 // referrer of about::blank in Window C since this navigation is more recent. | 178 // referrer of about::blank in Window C since this navigation is more recent. |
| 178 // However, it does not prevent us to attribute url1 in Window A as the cause | 179 // However, it does not prevent us to attribute url1 in Window A as the cause |
| 179 // of all these navigations. | 180 // of all these navigations. |
| 180 NavigationEvent* FindNavigationEvent(const GURL& target_url, | 181 NavigationEvent* FindNavigationEvent(const GURL& target_url, |
| 181 const GURL& target_main_frame_url, | 182 const GURL& target_main_frame_url, |
| 182 int target_tab_id); | 183 int target_tab_id); |
| 183 | 184 |
| 184 void AddToReferrerChain(ReferrerChain* referrer_chain, | 185 void AddToReferrerChain(ReferrerChain* referrer_chain, |
| 185 NavigationEvent* nav_event, | 186 NavigationEvent* nav_event, |
| 187 const GURL& destination_main_frame_url, |
| 186 ReferrerChainEntry::URLType type); | 188 ReferrerChainEntry::URLType type); |
| 187 | 189 |
| 188 // Helper function to get the remaining referrer chain when we've already | 190 // Helper function to get the remaining referrer chain when we've already |
| 189 // traced back |current_user_gesture_count| number of user gestures. | 191 // traced back |current_user_gesture_count| number of user gestures. |
| 190 // This function modifies the |out_referrer_chain| and |out_result|. | 192 // This function modifies the |out_referrer_chain| and |out_result|. |
| 191 void GetRemainingReferrerChain(NavigationEvent* last_nav_event_traced, | 193 void GetRemainingReferrerChain(NavigationEvent* last_nav_event_traced, |
| 192 int current_user_gesture_count, | 194 int current_user_gesture_count, |
| 193 int user_gesture_count_limit, | 195 int user_gesture_count_limit, |
| 194 ReferrerChain* out_referrer_chain, | 196 ReferrerChain* out_referrer_chain, |
| 195 AttributionResult* out_result); | 197 AttributionResult* out_result); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 218 | 220 |
| 219 content::NotificationRegistrar registrar_; | 221 content::NotificationRegistrar registrar_; |
| 220 | 222 |
| 221 base::OneShotTimer cleanup_timer_; | 223 base::OneShotTimer cleanup_timer_; |
| 222 | 224 |
| 223 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingNavigationObserverManager); | 225 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingNavigationObserverManager); |
| 224 }; | 226 }; |
| 225 } // namespace safe_browsing | 227 } // namespace safe_browsing |
| 226 | 228 |
| 227 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_MANAGE
R_H_ | 229 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_MANAGE
R_H_ |
| OLD | NEW |