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

Side by Side 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, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 package org.chromium.content_shell;
6
7 import android.content.Intent;
8 import android.view.ViewGroup;
9
10 import org.chromium.ui.base.ViewAndroidDelegate;
11
12 /**
13 * Implementation of the abstract class {@link ViewAndroidDelegate} for content shell.
14 * Extended for testing.
15 */
16 public class ShellViewAndroidDelegate extends ViewAndroidDelegate {
17 private final ViewGroup mContainerView;
18 private ContentIntentHandler mContentIntentHandler;
19
20 /**
21 * Interface used to define/modify what {@link #startContentIntent} does.
22 */
23 public interface ContentIntentHandler {
24 /**
25 * Called when intent url from content is received.
26 * @param intentUrl intent url.
27 */
28 void onIntentUrlReceived(String intentUrl);
29 }
30
31 public ShellViewAndroidDelegate(ViewGroup containerView) {
32 mContainerView = containerView;
33 }
34
35 /**
36 * Set the {@link ContentIntentHandler} for {@link #starContentIntent}.
37 * @param handler Handler to inject to {@link #startContentIntent}.
38 */
39 public void setContentIntentHandler(ContentIntentHandler handler) {
40 mContentIntentHandler = handler;
41 }
42
43 @Override
44 public void startContentIntent(Intent intent, String intentUrl, boolean isMa inFrame) {
45 if (mContentIntentHandler != null) mContentIntentHandler.onIntentUrlRece ived(intentUrl);
46 }
47
48 @Override
49 public ViewGroup getContainerView() {
50 return mContainerView;
51 }
52 }
OLDNEW
« 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