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

Unified Diff: ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java

Issue 2708703004: Reland "Refactor ContentViewClient (4/6)" (Closed)
Patch Set: rebased Created 3 years, 10 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
« no previous file with comments | « ui/android/BUILD.gn ('k') | ui/android/view_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
diff --git a/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java b/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
index 9a9d89beedcbc99147bb2ac2c28e1db5d6181a1a..bf674594c36a2faac4d29c4d974a04defb64d8e7 100644
--- a/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
+++ b/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java
@@ -5,6 +5,7 @@
package org.chromium.ui.base;
import android.content.ClipData;
+import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build;
import android.view.View;
@@ -13,18 +14,26 @@ import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageView;
import org.chromium.base.ApiCompatibilityUtils;
+import org.chromium.base.Log;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
+import java.net.URISyntaxException;
+
/**
* Class to acquire, position, and remove anchor views from the implementing View.
*/
@JNINamespace("ui")
public abstract class ViewAndroidDelegate {
+ private static final String TAG = "ViewAndroidDelegate";
// TODO(hush): use View#DRAG_FLAG_GLOBAL when Chromium starts to build with API 24.
private static final int DRAG_FLAG_GLOBAL = 1 << 8;
+ private static final String GEO_SCHEME = "geo";
+ private static final String TEL_SCHEME = "tel";
+ private static final String MAILTO_SCHEME = "mailto";
+
/**
* @return An anchor view that can be used to anchor decoration views like Autofill popup.
*/
@@ -105,6 +114,57 @@ public abstract class ViewAndroidDelegate {
}
/**
+ * Called whenever the background color of the page changes as notified by Blink.
+ * @param color The new ARGB color of the page background.
+ */
+ @CalledByNative
+ public void onBackgroundColorChanged(int color) {}
+
+ /**
+ * Notify the client of the position of the top controls.
+ * @param topControlsOffsetY The Y offset of the top controls in physical pixels.
+ * @param topContentOffsetY The Y offset of the content in physical pixels.
+ */
+ @CalledByNative
+ public void onTopControlsChanged(float topControlsOffsetY, float topContentOffsetY) {}
+
+ /**
+ * Notify the client of the position of the bottom controls.
+ * @param bottomControlsOffsetY The Y offset of the bottom controls in physical pixels.
+ * @param bottomContentOffsetY The Y offset of the content in physical pixels.
+ */
+ @CalledByNative
+ public void onBottomControlsChanged(float bottomControlsOffsetY, float bottomContentOffsetY) {}
+
+ /**
+ * Called when a new content intent is requested to be started.
+ * Invokes {@link #startContentIntent(Intent, String, boolean)} only if the parsed
+ * intent is valid and the scheme is acceptable.
+ */
+ @CalledByNative
+ private void onStartContentIntent(String intentUrl, boolean isMainFrame) {
+ Intent intent;
+ try {
+ intent = Intent.parseUri(intentUrl, Intent.URI_INTENT_SCHEME);
+ } catch (URISyntaxException e) {
+ Log.d(TAG, "Bad URI %s", intentUrl, e);
+ return;
+ }
+ String scheme = intent.getScheme();
+ if (!(GEO_SCHEME.equals(scheme) || TEL_SCHEME.equals(scheme)
+ || MAILTO_SCHEME.equals(scheme))) {
+ Log.d(TAG, "Invalid scheme for URI %s", intentUrl);
+ return;
+ }
+ startContentIntent(intent, intentUrl, isMainFrame);
+ }
+
+ /**
+ * Start a new content intent.
+ */
+ public void startContentIntent(Intent intent, String intentUrl, boolean isMainFrame) {}
+
+ /**
* @return container view that the anchor views are added to. May be null.
*/
@CalledByNative
« no previous file with comments | « ui/android/BUILD.gn ('k') | ui/android/view_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698