// Copyright 2023 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_SAFE_BROWSING_CONTENT_BROWSER_ASYNC_CHECK_TRACKER_H_ #define COMPONENTS_SAFE_BROWSING_CONTENT_BROWSER_ASYNC_CHECK_TRACKER_H_ #include <memory> #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/observer_list_types.h" #include "base/time/time.h" #include "components/safe_browsing/content/browser/url_checker_holder.h" #include "components/security_interstitials/core/unsafe_resource.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" namespace safe_browsing { class BaseUIManager; // AsyncCheckTracker is responsible for: // * Manage the lifetime of any `UrlCheckerHolder` that is not able to // complete before BrowserUrlLoaderThrottle::WillProcessResponse is called. // * Trigger a warning based on the result from `UrlCheckerHolder` if the // check is completed between BrowserUrlLoaderThrottle::WillProcessResponse and // WebContentsObserver::DidFinishNavigation. If the check is completed before // WillProcessResponse, SafeBrowsingNavigationThrottle will trigger the warning. // If the check is completed after DidFinishNavigation, // BaseUIManager::DisplayBlockingPage will trigger the warning. // * Track and provide the status of navigation that is associated with // UnsafeResource. Other classes can add themselves as an observer and get // notified when certain events happen. // This class should only be called on the UI thread. class AsyncCheckTracker : public content::WebContentsUserData<AsyncCheckTracker>, public content::WebContentsObserver { … }; } // namespace safe_browsing #endif // COMPONENTS_SAFE_BROWSING_CONTENT_BROWSER_ASYNC_CHECK_TRACKER_H_