| Index: components/subresource_filter/content/browser/subresource_filter_activation_navigation_throttle.h
|
| diff --git a/components/subresource_filter/content/browser/subresource_filter_activation_navigation_throttle.h b/components/subresource_filter/content/browser/subresource_filter_activation_navigation_throttle.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1e62c52b46ff8a2107b32735c75af42d06b70825
|
| --- /dev/null
|
| +++ b/components/subresource_filter/content/browser/subresource_filter_activation_navigation_throttle.h
|
| @@ -0,0 +1,67 @@
|
| +// Copyright (c) 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_ACTIVATION_RESOURCE_THROTTLE_H_
|
| +#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_ACTIVATION_RESOURCE_THROTTLE_H_
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/time/time.h"
|
| +#include "base/timer/timer.h"
|
| +#include "components/safe_browsing_db/database_manager.h"
|
| +#include "content/public/browser/navigation_throttle.h"
|
| +#include "url/gurl.h"
|
| +
|
| +namespace subresource_filter {
|
| +
|
| +// Client for accessing list with patterns to be used by the Subresource Filter.
|
| +class SubresourceFilterActivationNavigationThrottle
|
| + : public content::NavigationThrottle,
|
| + public safe_browsing::SafeBrowsingDatabaseManager::Client,
|
| + public base::SupportsWeakPtr<
|
| + SubresourceFilterActivationNavigationThrottle> {
|
| + public:
|
| + SubresourceFilterActivationNavigationThrottle(
|
| + content::NavigationHandle* handle,
|
| + const scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager>&
|
| + database_manager);
|
| +
|
| + ~SubresourceFilterActivationNavigationThrottle() override;
|
| +
|
| + content::NavigationThrottle::ThrottleCheckResult WillProcessResponse()
|
| + override;
|
| +
|
| + // SafeBrowsingDabaseManager::Client implementation (called on IO thread):
|
| + void OnCheckBrowseUrlResult(
|
| + const GURL& url,
|
| + safe_browsing::SBThreatType result,
|
| + const safe_browsing::ThreatMetadata& metadata) override;
|
| +
|
| + private:
|
| + // Callback for when the safe browsing check has taken longer than
|
| + // kCheckUrlTimeoutMs.
|
| + void OnCheckUrlTimeout();
|
| +
|
| + void CheckUrlOnIO(const GURL& url);
|
| +
|
| + void OnCheckUrlResultOnUI(const GURL& url,
|
| + safe_browsing::SBThreatType threat_type,
|
| + safe_browsing::ThreatPatternType pattern_type);
|
| +
|
| + // Timer to abort the safe browsing check if it takes too long.
|
| + base::OneShotTimer timer_;
|
| +
|
| + scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager_;
|
| +
|
| + GURL url_being_checked_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(SubresourceFilterActivationNavigationThrottle);
|
| +};
|
| +
|
| +} // namespace subresource_filter
|
| +
|
| +#endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_ACTIVATION_RESOURCE_THROTTLE_H_
|
|
|