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

Side by Side Diff: android_webview/browser/aw_safe_browsing_ui_manager.cc

Issue 2898593002: WebView: choose loud vs. quiet interstitial (Closed)
Patch Set: Rebase, fix merge conflicts Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 "android_webview/browser/aw_safe_browsing_blocking_page.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 9
10 using content::BrowserThread; 10 using content::BrowserThread;
11 using content::WebContents; 11 using content::WebContents;
12 12
13 namespace android_webview { 13 namespace android_webview {
14 14
15 AwSafeBrowsingUIManager::AwSafeBrowsingUIManager() { 15 AwSafeBrowsingUIManager::AwSafeBrowsingUIManager() {
16 DCHECK_CURRENTLY_ON(BrowserThread::UI); 16 DCHECK_CURRENTLY_ON(BrowserThread::UI);
17 } 17 }
18 18
19 AwSafeBrowsingUIManager::~AwSafeBrowsingUIManager() {} 19 AwSafeBrowsingUIManager::~AwSafeBrowsingUIManager() {}
20 20
21 void AwSafeBrowsingUIManager::DisplayBlockingPage( 21 void AwSafeBrowsingUIManager::DisplayBlockingPage(
22 const UnsafeResource& resource) { 22 const UnsafeResource& resource) {
23 DCHECK_CURRENTLY_ON(BrowserThread::UI); 23 DCHECK_CURRENTLY_ON(BrowserThread::UI);
24 24
25 WebContents* web_contents = resource.web_contents_getter.Run(); 25 WebContents* web_contents = resource.web_contents_getter.Run();
26 // Check the size of the view 26 // Check the size of the view
27 UIManagerClient* client = UIManagerClient::FromWebContents(web_contents); 27 UIManagerClient* client = UIManagerClient::FromWebContents(web_contents);
28 if (!client || !client->CanShowBigInterstitial()) { 28 if (!client || !client->CanShowInterstitial()) {
29 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";
30 OnBlockingPageDone(std::vector<UnsafeResource>{resource}, false, 30 OnBlockingPageDone(std::vector<UnsafeResource>{resource}, false,
31 web_contents, resource.url.GetWithEmptyPath()); 31 web_contents, resource.url.GetWithEmptyPath());
32 return; 32 return;
33 } 33 }
34 safe_browsing::BaseUIManager::DisplayBlockingPage(resource); 34 safe_browsing::BaseUIManager::DisplayBlockingPage(resource);
35 } 35 }
36 36
37 void AwSafeBrowsingUIManager::ShowBlockingPageForResource( 37 void AwSafeBrowsingUIManager::ShowBlockingPageForResource(
38 const UnsafeResource& resource) { 38 const UnsafeResource& resource) {
39 AwSafeBrowsingBlockingPage::ShowBlockingPage(this, resource); 39 AwSafeBrowsingBlockingPage::ShowBlockingPage(this, resource);
40 } 40 }
41 41
42 int AwSafeBrowsingUIManager::GetErrorUiType(
43 const UnsafeResource& resource) const {
44 WebContents* web_contents = resource.web_contents_getter.Run();
45 UIManagerClient* client = UIManagerClient::FromWebContents(web_contents);
46 return client && client->GetErrorUiType();
47 }
48
42 } // namespace android_webview 49 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698