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

Unified Diff: content/shell/android/java/src/org/chromium/content_shell/ShellViewAndroidDelegate.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 | « content/shell/android/java/src/org/chromium/content_shell/Shell.java ('k') | ui/android/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/android/java/src/org/chromium/content_shell/ShellViewAndroidDelegate.java
diff --git a/content/shell/android/java/src/org/chromium/content_shell/ShellViewAndroidDelegate.java b/content/shell/android/java/src/org/chromium/content_shell/ShellViewAndroidDelegate.java
new file mode 100644
index 0000000000000000000000000000000000000000..b1102b3aa953d0e7ea939f0c050a72c05afb478f
--- /dev/null
+++ b/content/shell/android/java/src/org/chromium/content_shell/ShellViewAndroidDelegate.java
@@ -0,0 +1,52 @@
+// 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.
+
+package org.chromium.content_shell;
+
+import android.content.Intent;
+import android.view.ViewGroup;
+
+import org.chromium.ui.base.ViewAndroidDelegate;
+
+/**
+ * Implementation of the abstract class {@link ViewAndroidDelegate} for content shell.
+ * Extended for testing.
+ */
+public class ShellViewAndroidDelegate extends ViewAndroidDelegate {
+ private final ViewGroup mContainerView;
+ private ContentIntentHandler mContentIntentHandler;
+
+ /**
+ * Interface used to define/modify what {@link #startContentIntent} does.
+ */
+ public interface ContentIntentHandler {
+ /**
+ * Called when intent url from content is received.
+ * @param intentUrl intent url.
+ */
+ void onIntentUrlReceived(String intentUrl);
+ }
+
+ public ShellViewAndroidDelegate(ViewGroup containerView) {
+ mContainerView = containerView;
+ }
+
+ /**
+ * Set the {@link ContentIntentHandler} for {@link #starContentIntent}.
+ * @param handler Handler to inject to {@link #startContentIntent}.
+ */
+ public void setContentIntentHandler(ContentIntentHandler handler) {
+ mContentIntentHandler = handler;
+ }
+
+ @Override
+ public void startContentIntent(Intent intent, String intentUrl, boolean isMainFrame) {
+ if (mContentIntentHandler != null) mContentIntentHandler.onIntentUrlReceived(intentUrl);
+ }
+
+ @Override
+ public ViewGroup getContainerView() {
+ return mContainerView;
+ }
+}
« no previous file with comments | « content/shell/android/java/src/org/chromium/content_shell/Shell.java ('k') | ui/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698