Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(932)

Unified Diff: chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h

Issue 2578363002: Wire up download attribution enable finch experiment (Closed)
Patch Set: Remove unnecessary includes Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 7a47da80686063e0fd9b2982324e4b36188cd2aa..9bfcfa1bb44a54f993475f9e472ace0c546b2ed0 100644
--- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h
+++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_manager.h
@@ -5,12 +5,15 @@
#ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_MANAGER_H_
#define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_NAVIGATION_OBSERVER_MANAGER_H_
+#include "base/feature_list.h"
#include "chrome/common/safe_browsing/csd.pb.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
#include "url/gurl.h"
+class Profile;
+
namespace safe_browsing {
class SafeBrowsingNavigationObserver;
@@ -28,6 +31,8 @@ class SafeBrowsingNavigationObserverManager
: public content::NotificationObserver,
public base::RefCountedThreadSafe<SafeBrowsingNavigationObserverManager> {
public:
+ static const base::Feature kDownloadAttribution;
+
// For UMA histogram counting. Do NOT change order.
enum AttributionResult {
SUCCESS = 1, // Identified referrer chain is not empty.
@@ -43,12 +48,18 @@ class SafeBrowsingNavigationObserverManager
// Helper function to check if user gesture is older than
// kUserGestureTTLInSecond.
static bool IsUserGestureExpired(const base::Time& timestamp);
+
// Helper function to strip empty ref fragment from a URL. Many pages
// end up with a "#" at the end of their URLs due to navigation triggered by
// href="#" and javascript onclick function. We don't want to have separate
// entries for these cases in the maps.
static GURL ClearEmptyRef(const GURL& url);
+ // Checks if we should enable observing navigations for safe browsing purpose.
+ // Return true if the safe browsing service and the download attribution
+ // feature are both enabled, and safe browsing service is initialized.
+ static bool IsEnabledAndReady(Profile* profile);
+
SafeBrowsingNavigationObserverManager();
// Add |nav_event| to |navigation_map_| based on |nav_event_key|. Object
@@ -80,15 +91,6 @@ class SafeBrowsingNavigationObserverManager
int user_gesture_count_limit,
std::vector<ReferrerChainEntry>* out_referrer_chain);
- // Identify and add referrer chain info of a download to ClientDownloadRequest
- // proto. This function also record UMA stats of download attribution result.
- // TODO(jialiul): This function will be moved to DownloadProtectionService
- // class shortly.
- void AddReferrerChainToClientDownloadRequest(
- const GURL& download_url,
- content::WebContents* source_contents,
- ClientDownloadRequest* out_request);
-
private:
friend class base::RefCountedThreadSafe<
SafeBrowsingNavigationObserverManager>;

Powered by Google App Engine
This is Rietveld 408576698