1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef COMPONENTS_SAFE_BROWSING_CORE_BROWSER_REFERRER_CHAIN_PROVIDER_H_ 6 #define COMPONENTS_SAFE_BROWSING_CORE_BROWSER_REFERRER_CHAIN_PROVIDER_H_ 7 8 #include "components/safe_browsing/core/proto/csd.pb.h" 9 #include "components/sessions/core/session_id.h" 10 #include "url/gurl.h" 11 12 namespace content { 13 class WebContents; 14 } 15 16 namespace safe_browsing { 17 using ReferrerChain = 18 google::protobuf::RepeatedPtrField<safe_browsing::ReferrerChainEntry>; 19 20 class ReferrerChainProvider { 21 public: 22 // For UMA histogram counting. Do NOT change order. 23 enum AttributionResult { 24 SUCCESS = 1, // Identified referrer chain is not empty. 25 SUCCESS_LANDING_PAGE = 2, // Successfully identified landing page. 26 SUCCESS_LANDING_REFERRER = 3, // Successfully identified landing referrer. 27 INVALID_URL = 4, 28 NAVIGATION_EVENT_NOT_FOUND = 5, 29 SUCCESS_REFERRER = 6, // Successfully identified extra referrers beyond the 30 // landing referrer. 31 32 // Always at the end. 33 ATTRIBUTION_FAILURE_TYPE_MAX 34 }; 35 36 virtual AttributionResult IdentifyReferrerChainByWebContents( 37 content::WebContents* web_contents, 38 int user_gesture_count_limit, 39 ReferrerChain* out_referrer_chain) = 0; 40 41 virtual AttributionResult IdentifyReferrerChainByEventURL( 42 const GURL& event_url, 43 SessionID event_tab_id, 44 int user_gesture_count_limit, 45 ReferrerChain* out_referrer_chain) = 0; 46 }; 47 } // namespace safe_browsing 48 49 #endif // COMPONENTS_SAFE_BROWSING_CORE_BROWSER_REFERRER_CHAIN_PROVIDER_H_ 50