| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_NAVIGATION_THROTTLE_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_NAVIGATION_THROTTLE_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 12 #include "chrome/browser/safe_browsing/ui_manager.h" |
| 13 #include "components/safe_browsing_db/database_manager.h" |
| 14 #include "content/public/browser/navigation_throttle.h" |
| 15 |
| 16 class SafeBrowsingNavigationThrottle |
| 17 : public content::NavigationThrottle, |
| 18 public safe_browsing::SafeBrowsingDatabaseManager::Client, |
| 19 public base::SupportsWeakPtr<SafeBrowsingNavigationThrottle> { |
| 20 public: |
| 21 static std::unique_ptr<content::NavigationThrottle> MaybeCreate( |
| 22 content::NavigationHandle* handle, |
| 23 safe_browsing::SafeBrowsingService* sb_service); |
| 24 ~SafeBrowsingNavigationThrottle() override; |
| 25 |
| 26 private: |
| 27 explicit SafeBrowsingNavigationThrottle( |
| 28 content::NavigationHandle* handle, |
| 29 safe_browsing::SafeBrowsingService* sb_service); |
| 30 |
| 31 // content::NavigationThrottle implementation: |
| 32 content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override; |
| 33 content::NavigationThrottle::ThrottleCheckResult WillRedirectRequest() |
| 34 override; |
| 35 |
| 36 // SafeBrowsingDatabaseManager::Client implementation: |
| 37 void OnCheckBrowseUrlResult( |
| 38 const GURL& url, |
| 39 safe_browsing::SBThreatType result, |
| 40 const safe_browsing::ThreatMetadata& metadata) override; |
| 41 |
| 42 void CheckUrlOnIO(const GURL& url); |
| 43 |
| 44 content::WebContents* GetNavigationHandlesWebContents(); |
| 45 void OnCheckUrlResultOnUI(const GURL& url, |
| 46 safe_browsing::SBThreatType result, |
| 47 const safe_browsing::ThreatMetadata& metadata); |
| 48 void OnBlockingPageComplete(bool proceed); |
| 49 |
| 50 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager_; |
| 51 scoped_refptr<safe_browsing::SafeBrowsingUIManager> ui_manager_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingNavigationThrottle); |
| 54 }; |
| 55 |
| 56 #endif // CHROME_BROWSER_RENDERER_HOST_SAFE_BROWSING_NAVIGATION_THROTTLE_H_ |
| OLD | NEW |