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 #include "android_webview/browser/aw_safe_browsing_ui_manager.h" | 5 #include "android_webview/browser/aw_safe_browsing_ui_manager.h" |
6 | 6 |
| 7 #include "android_webview/browser/aw_safe_browsing_blocking_page.h" |
7 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
8 | 9 |
9 using content::BrowserThread; | 10 using content::BrowserThread; |
10 using content::WebContents; | 11 using content::WebContents; |
11 | 12 |
12 namespace android_webview { | 13 namespace android_webview { |
13 | 14 |
14 AwSafeBrowsingUIManager::AwSafeBrowsingUIManager() { | 15 AwSafeBrowsingUIManager::AwSafeBrowsingUIManager() { |
15 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 16 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
16 } | 17 } |
17 | 18 |
18 AwSafeBrowsingUIManager::~AwSafeBrowsingUIManager() {} | 19 AwSafeBrowsingUIManager::~AwSafeBrowsingUIManager() {} |
19 | 20 |
20 void AwSafeBrowsingUIManager::DisplayBlockingPage( | 21 void AwSafeBrowsingUIManager::DisplayBlockingPage( |
21 const UnsafeResource& resource) { | 22 const UnsafeResource& resource) { |
22 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 23 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
23 | 24 |
24 WebContents* web_contents = resource.web_contents_getter.Run(); | 25 WebContents* web_contents = resource.web_contents_getter.Run(); |
25 // Check the size of the view | 26 // Check the size of the view |
26 UIManagerClient* client = UIManagerClient::FromWebContents(web_contents); | 27 UIManagerClient* client = UIManagerClient::FromWebContents(web_contents); |
27 if (!client || !client->CanShowBigInterstitial()) { | 28 if (!client || !client->CanShowBigInterstitial()) { |
28 LOG(WARNING) << "The view is not suitable to show the SB interstitial"; | 29 LOG(WARNING) << "The view is not suitable to show the SB interstitial"; |
29 OnBlockingPageDone(std::vector<UnsafeResource>{resource}, false, | 30 OnBlockingPageDone(std::vector<UnsafeResource>{resource}, false, |
30 web_contents, resource.url.GetWithEmptyPath()); | 31 web_contents, resource.url.GetWithEmptyPath()); |
31 return; | 32 return; |
32 } | 33 } |
33 safe_browsing::BaseUIManager::DisplayBlockingPage(resource); | 34 safe_browsing::BaseUIManager::DisplayBlockingPage(resource); |
34 } | 35 } |
35 | 36 |
| 37 void AwSafeBrowsingUIManager::ShowBlockingPageForResource( |
| 38 const UnsafeResource& resource) { |
| 39 AwSafeBrowsingBlockingPage::ShowBlockingPage(this, resource); |
| 40 } |
| 41 |
36 } // namespace android_webview | 42 } // namespace android_webview |
OLD | NEW |