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

Unified Diff: chrome/browser/renderer_host/safe_browsing_navigation_throttle.h

Issue 2238383002: Add SafeBrowsingNavigationThrottle Base URL: https://chromium.googlesource.com/chromium/src.git@unsafe-resource-to-webcontents
Patch Set: . Created 4 years, 4 months 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/renderer_host/safe_browsing_navigation_throttle.h
diff --git a/chrome/browser/renderer_host/safe_browsing_navigation_throttle.h b/chrome/browser/renderer_host/safe_browsing_navigation_throttle.h
new file mode 100644
index 0000000000000000000000000000000000000000..43048456b5cf3691c65d07be7b50229a4b4e3057
--- /dev/null
+++ b/chrome/browser/renderer_host/safe_browsing_navigation_throttle.h
@@ -0,0 +1,56 @@
+// Copyright 2016 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 CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_NAVIGATION_THROTTLE_H_
+#define CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_NAVIGATION_THROTTLE_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "chrome/browser/safe_browsing/safe_browsing_service.h"
+#include "chrome/browser/safe_browsing/ui_manager.h"
+#include "components/safe_browsing_db/database_manager.h"
+#include "content/public/browser/navigation_throttle.h"
+
+class SafeBrowsingNavigationThrottle
+ : public content::NavigationThrottle,
+ public safe_browsing::SafeBrowsingDatabaseManager::Client,
+ public base::SupportsWeakPtr<SafeBrowsingNavigationThrottle> {
+ public:
+ static std::unique_ptr<content::NavigationThrottle> MaybeCreate(
+ content::NavigationHandle* handle,
+ safe_browsing::SafeBrowsingService* sb_service);
+ ~SafeBrowsingNavigationThrottle() override;
+
+ private:
+ explicit SafeBrowsingNavigationThrottle(
+ content::NavigationHandle* handle,
+ safe_browsing::SafeBrowsingService* sb_service);
+
+ // content::NavigationThrottle implementation:
+ content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override;
+ content::NavigationThrottle::ThrottleCheckResult WillRedirectRequest()
+ override;
+
+ // SafeBrowsingDatabaseManager::Client implementation:
+ void OnCheckBrowseUrlResult(
+ const GURL& url,
+ safe_browsing::SBThreatType result,
+ const safe_browsing::ThreatMetadata& metadata) override;
+
+ void CheckUrlOnIO(const GURL& url);
+
+ content::WebContents* GetNavigationHandlesWebContents();
+ void OnCheckUrlResultOnUI(const GURL& url,
+ safe_browsing::SBThreatType result,
+ const safe_browsing::ThreatMetadata& metadata);
+ void OnBlockingPageComplete(bool proceed);
+
+ scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager_;
+ scoped_refptr<safe_browsing::SafeBrowsingUIManager> ui_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(SafeBrowsingNavigationThrottle);
+};
+
+#endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_NAVIGATION_THROTTLE_H_

Powered by Google App Engine
This is Rietveld 408576698