| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_SAFE_BROWSING_RESOURCE_THROTTLE_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_SAFE_BROWSING_RESOURCE_THROTTLE_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_AW_SAFE_BROWSING_RESOURCE_THROTTLE_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_AW_SAFE_BROWSING_RESOURCE_THROTTLE_H_ |
| 7 | 7 |
| 8 #include "android_webview/browser/aw_safe_browsing_ui_manager.h" | 8 #include <memory> |
| 9 #include "base/macros.h" | 9 |
| 10 #include "components/safe_browsing/base_resource_throttle.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "components/safe_browsing_db/database_manager.h" | |
| 12 #include "components/security_interstitials/content/unsafe_resource.h" | |
| 13 #include "content/public/common/resource_type.h" | 11 #include "content/public/common/resource_type.h" |
| 14 | 12 |
| 13 namespace content { |
| 14 class ResourceThrottle; |
| 15 } |
| 16 |
| 15 namespace net { | 17 namespace net { |
| 16 class URLRequest; | 18 class URLRequest; |
| 17 } | 19 } |
| 18 | 20 |
| 21 namespace safe_browsing { |
| 22 class SafeBrowsingDatabaseManager; |
| 23 } |
| 24 |
| 19 namespace android_webview { | 25 namespace android_webview { |
| 20 | 26 |
| 21 class AwSafeBrowsingResourceThrottle | 27 class AwSafeBrowsingUIManager; |
| 22 : public safe_browsing::BaseResourceThrottle { | |
| 23 public: | |
| 24 // Will construct an AwSafeBrowsingResourceThrottle if GMS exists on device | |
| 25 // and supports safebrowsing. | |
| 26 static AwSafeBrowsingResourceThrottle* MaybeCreate( | |
| 27 net::URLRequest* request, | |
| 28 content::ResourceType resource_type, | |
| 29 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> | |
| 30 database_manager, | |
| 31 scoped_refptr<AwSafeBrowsingUIManager> ui_manager); | |
| 32 | 28 |
| 33 private: | 29 std::unique_ptr<content::ResourceThrottle> |
| 34 AwSafeBrowsingResourceThrottle( | 30 MaybeCreateAwSafeBrowsingResourceThrottle( |
| 35 net::URLRequest* request, | 31 net::URLRequest* request, |
| 36 content::ResourceType resource_type, | 32 content::ResourceType resource_type, |
| 37 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> | 33 scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager> database_manager, |
| 38 database_manager, | 34 scoped_refptr<AwSafeBrowsingUIManager> ui_manager); |
| 39 scoped_refptr<AwSafeBrowsingUIManager> ui_manager); | |
| 40 | |
| 41 ~AwSafeBrowsingResourceThrottle() override; | |
| 42 | |
| 43 void CancelResourceLoad() override; | |
| 44 | |
| 45 DISALLOW_COPY_AND_ASSIGN(AwSafeBrowsingResourceThrottle); | |
| 46 }; | |
| 47 | 35 |
| 48 } // namespace android_webview | 36 } // namespace android_webview |
| 49 | 37 |
| 50 #endif // ANDROID_WEBVIEW_BROWSER_AW_SAFE_BROWSING_RESOURCE_THROTTLE_H_ | 38 #endif // ANDROID_WEBVIEW_BROWSER_AW_SAFE_BROWSING_RESOURCE_THROTTLE_H_ |
| OLD | NEW |