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

Unified Diff: android_webview/browser/aw_safe_browsing_ui_manager.cc

Issue 2635693002: [WebView] initial webview-side implementation of safebrowsing (Closed)
Patch Set: rename lock, add crbug comment Created 3 years, 11 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: android_webview/browser/aw_safe_browsing_ui_manager.cc
diff --git a/android_webview/browser/aw_safe_browsing_ui_manager.cc b/android_webview/browser/aw_safe_browsing_ui_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c2ac6571f7e39b52f60b7082abb4ba8fb586e3b5
--- /dev/null
+++ b/android_webview/browser/aw_safe_browsing_ui_manager.cc
@@ -0,0 +1,36 @@
+// Copyright 2017 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.
+
+#include "android_webview/browser/aw_safe_browsing_ui_manager.h"
+
+#include "content/public/browser/browser_thread.h"
+
+using content::BrowserThread;
+using content::WebContents;
+
+namespace android_webview {
+
+AwSafeBrowsingUIManager::AwSafeBrowsingUIManager() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+}
+
+AwSafeBrowsingUIManager::~AwSafeBrowsingUIManager() {}
+
+void AwSafeBrowsingUIManager::DisplayBlockingPage(
+ const UnsafeResource& resource) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ WebContents* web_contents = resource.web_contents_getter.Run();
+ // Check the size of the view
+ UIManagerClient* client = UIManagerClient::FromWebContents(web_contents);
+ if (!client || !client->CanShowInterstitial()) {
+ LOG(WARNING) << "The view is not suitable to show the SB interstitial";
+ OnBlockingPageDone(std::vector<UnsafeResource>{resource}, false,
+ web_contents, resource.url.GetWithEmptyPath());
+ return;
+ }
+ safe_browsing::BaseUIManager::DisplayBlockingPage(resource);
+}
+
+} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698