Index: chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h |
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h |
index 9bfcfa1bb44a54f993475f9e472ace0c546b2ed0..87abb017473d0abf8e7aaaef3c96d58873ffceef 100644 |
--- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h |
+++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h |
@@ -85,12 +85,26 @@ class SafeBrowsingNavigationObserverManager |
// |user_gesture_count_limit| number of user gestures. Then convert these |
// identified NavigationEvents into ReferrerChainEntrys and append them to |
// |out_referrer_chain|. |
- AttributionResult IdentifyReferrerChain( |
+ AttributionResult IdentifyReferrerChainForDownload( |
const GURL& target_url, |
int target_tab_id, // -1 if tab id is not valid |
int user_gesture_count_limit, |
std::vector<ReferrerChainEntry>* out_referrer_chain); |
+ // Based on the |initiating_frame_url| and its associated |web_contents|, |
+ // trace back the observed NavigationEvents in navigation_map_ to identify the |
+ // sequence of navigations leading to this |initiating_frame_url|. If this |
+ // initiating frame has a user gesture, we trace back with the coverage |
+ // limited to |user_gesture_count_limit|-1 number of user gestures, otherwise |
+ // we trace back |user_gesture_count_limit| number of user gestures. We then |
+ // convert these identified NavigationEvents into ReferrerChainEntrys and |
+ // append them to |out_referrer_chain|. |
+ AttributionResult IdentifyReferrerChainForPPAPIDownload( |
+ const GURL& initiating_frame_url, |
+ content::WebContents* web_contents, |
+ int user_gesture_count_limit, |
+ std::vector<ReferrerChainEntry>* out_referrer_chain); |
+ |
private: |
friend class base::RefCountedThreadSafe< |
SafeBrowsingNavigationObserverManager>; |
@@ -162,6 +176,16 @@ class SafeBrowsingNavigationObserverManager |
NavigationEvent* nav_event, |
ReferrerChainEntry::URLType type); |
+ // Helper function to get the remaining referrer chain when we've already |
+ // traced back |current_user_gesture_count| number of user gestures. |
+ // This function modifies the |out_referrer_chain| and |out_result|. |
+ void GetRemainingReferrerChain( |
+ NavigationEvent* last_nav_event_traced, |
+ int current_user_gesture_count, |
+ int user_gesture_count_limit, |
+ std::vector<ReferrerChainEntry>* out_referrer_chain, |
+ AttributionResult* out_result); |
+ |
// navigation_map_ keeps track of all the observed navigations. This map is |
// keyed on the resolved request url. In other words, in case of server |
// redirects, its key is the last server redirect url, otherwise, it is the |