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

Issue 2615393002: Implement the basics for Safebrowsing for WebView (Closed)

Created:
3 years, 11 months ago by sgurun-gerrit only
Modified:
3 years, 11 months ago
CC:
chromium-reviews, creis+watch_chromium.org, grt+watch_chromium.org, nasko+codewatch_chromium.org, jam, darin-cc_chromium.org, agrieve+watch_chromium.org, android-webview-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

This CL implements the basics for Safebrowsing for Webview - A basic UI manager that decides (using a simple policy) whether or not show an interstitial - A mechanism to call back to GMSCore for checking

Patch Set 1 #

Patch Set 2 : rebased #

Patch Set 3 : locale setting is correct #

Patch Set 4 : removed last hack from components #

Patch Set 5 : minor cleanup #

Patch Set 6 : rebased #

Patch Set 7 : removed awsaefbrowsingapihandler #

Patch Set 8 : deps, etc #

Patch Set 9 : more cleanup #

Unified diffs Side-by-side diffs Delta from patch set Stats (+197 lines, -1 line) Patch
M android_webview/BUILD.gn View 1 2 3 4 5 6 3 chunks +5 lines, -0 lines 0 comments Download
M android_webview/apk/java/proguard.flags View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 0 comments Download
M android_webview/browser/DEPS View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M android_webview/browser/aw_browser_context.h View 1 3 chunks +10 lines, -0 lines 0 comments Download
M android_webview/browser/aw_browser_context.cc View 1 2 3 4 5 6 7 8 2 chunks +22 lines, -0 lines 0 comments Download
A android_webview/browser/aw_safe_browsing_ui_manager.h View 1 2 3 4 1 chunk +41 lines, -0 lines 0 comments Download
A android_webview/browser/aw_safe_browsing_ui_manager.cc View 1 2 3 4 5 6 7 8 1 chunk +36 lines, -0 lines 0 comments Download
M android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc View 1 2 3 4 5 6 7 8 2 chunks +12 lines, -0 lines 0 comments Download
M android_webview/java/src/org/chromium/android_webview/AwBrowserContext.java View 1 2 3 4 5 6 7 3 chunks +19 lines, -0 lines 0 comments Download
M android_webview/java/src/org/chromium/android_webview/AwContents.java View 1 2 3 4 5 6 7 8 1 chunk +11 lines, -0 lines 0 comments Download
M android_webview/lib/main/aw_main_delegate.h View 2 chunks +6 lines, -0 lines 0 comments Download
M android_webview/lib/main/aw_main_delegate.cc View 1 2 3 4 5 6 7 2 chunks +6 lines, -0 lines 0 comments Download
M android_webview/native/aw_contents.h View 1 2 3 4 5 6 7 3 chunks +6 lines, -1 line 0 comments Download
M android_webview/native/aw_contents.cc View 1 2 3 3 chunks +17 lines, -0 lines 0 comments Download

Messages

Total messages: 5 (4 generated)
Nate Fischer
3 years, 11 months ago (2017-01-13 23:23:37 UTC) #2
After the internal CL lands, you should apply a patch like this to integrate it:


diff --git a/android_webview/BUILD.gn b/android_webview/BUILD.gn
index 19a7de254777..8b189425e775 100644
--- a/android_webview/BUILD.gn
+++ b/android_webview/BUILD.gn
@@ -576,7 +576,6 @@ android_library("android_webview_java") {
     "java/src/org/chromium/android_webview/AwPrintDocumentAdapter.java",
     "java/src/org/chromium/android_webview/AwQuotaManagerBridge.java",
     "java/src/org/chromium/android_webview/AwResource.java",
-    "java/src/org/chromium/android_webview/AwSafeBrowsingApiHandler.java",
     "java/src/org/chromium/android_webview/AwScrollOffsetManager.java",
     "java/src/org/chromium/android_webview/AwServiceWorkerClient.java",
     "java/src/org/chromium/android_webview/AwServiceWorkerController.java",
diff --git
a/android_webview/java/src/org/chromium/android_webview/AwBrowserContext.java
b/android_webview/java/src/org/chromium/android_webview/AwBrowserContext.java
index d7d627193aa6..b1beb33ed84e 100644
---
a/android_webview/java/src/org/chromium/android_webview/AwBrowserContext.java
+++
b/android_webview/java/src/org/chromium/android_webview/AwBrowserContext.java
@@ -9,8 +9,8 @@ import android.content.SharedPreferences;
 
 import org.chromium.content.browser.AppWebMessagePortService;
 import org.chromium.content.browser.ContentViewStatics;
-
 import org.chromium.components.safe_browsing.SafeBrowsingApiBridge;
+import org.chromium.components.safe_browsing.SafeBrowsingApiHandler;
 
 /**
  * Java side of the Browser Context: contains all the java side objects needed
to host one
@@ -30,13 +30,23 @@ public class AwBrowserContext {
     private AwServiceWorkerController mServiceWorkerController;
     private Context mApplicationContext;
 
+    private static final String SAFE_BROWSING_API_HANDLER =
+            "com.android.webview.chromium.AwSafeBrowsingApiHandler";
+
     public AwBrowserContext(SharedPreferences sharedPreferences, Context
applicationContext) {
         mSharedPreferences = sharedPreferences;
         mMetricsServiceClient = new AwMetricsServiceClient(applicationContext);
         mApplicationContext = applicationContext;
 
-        // TODO(sgurun) is this a good place?
-       
SafeBrowsingApiBridge.setSafeBrowingHandlerType(AwSafeBrowsingApiHandler.class);
+        try {
+            Class<? extends SafeBrowsingApiHandler> cls =
+                    (Class<? extends SafeBrowsingApiHandler>) Class.forName(
+                            SAFE_BROWSING_API_HANDLER);
+            SafeBrowsingApiBridge.setSafeBrowingHandlerType(cls);
+
+        } catch (ClassNotFoundException e) {
+            // This is not an error; it just means this device doesn't have
specialized services.
+        }
     }
 
     public AwGeolocationPermissions getGeolocationPermissions() {

Powered by Google App Engine
This is Rietveld 408576698