| 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 ccf2b04eefe6eaaf5ea9c5f59308894a4ffc2203..6fdf7c37fb82b2b7c9bdc40c04f7efbc4c826706 100644
|
| --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h
|
| +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h
|
| @@ -70,6 +70,7 @@ class SafeBrowsingNavigationObserverManager
|
| const base::Time& timestamp);
|
| void OnUserGestureConsumed(content::WebContents* web_contents,
|
| const base::Time& timestamp);
|
| + bool HasUserGesture(content::WebContents* web_contents);
|
| void RecordHostToIpMapping(const std::string& host, const std::string& ip);
|
|
|
| // Clean-ups need to be done when a WebContents gets destroyed.
|
| @@ -85,12 +86,27 @@ 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 |tab_id|, 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,
|
| + int tab_id,
|
| + bool has_user_gesture,
|
| + int user_gesture_count_limit,
|
| + std::vector<ReferrerChainEntry>* out_referrer_chain);
|
| +
|
| private:
|
| friend class base::RefCountedThreadSafe<
|
| SafeBrowsingNavigationObserverManager>;
|
| @@ -168,6 +184,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
|
|
|