| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content_shell; | 5 package org.chromium.content_shell; |
| 6 | 6 |
| 7 import android.content.Intent; | 7 import android.content.Intent; |
| 8 import android.view.ViewGroup; | 8 import android.view.ViewGroup; |
| 9 | 9 |
| 10 import org.chromium.base.Log; |
| 10 import org.chromium.ui.base.ViewAndroidDelegate; | 11 import org.chromium.ui.base.ViewAndroidDelegate; |
| 11 | 12 |
| 12 /** | 13 /** |
| 13 * Implementation of the abstract class {@link ViewAndroidDelegate} for content
shell. | 14 * Implementation of the abstract class {@link ViewAndroidDelegate} for content
shell. |
| 14 * Extended for testing. | 15 * Extended for testing. |
| 15 */ | 16 */ |
| 16 public class ShellViewAndroidDelegate extends ViewAndroidDelegate { | 17 public class ShellViewAndroidDelegate extends ViewAndroidDelegate { |
| 17 private final ViewGroup mContainerView; | 18 private final ViewGroup mContainerView; |
| 18 private ContentIntentHandler mContentIntentHandler; | 19 private ContentIntentHandler mContentIntentHandler; |
| 19 | 20 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 30 | 31 |
| 31 public ShellViewAndroidDelegate(ViewGroup containerView) { | 32 public ShellViewAndroidDelegate(ViewGroup containerView) { |
| 32 mContainerView = containerView; | 33 mContainerView = containerView; |
| 33 } | 34 } |
| 34 | 35 |
| 35 /** | 36 /** |
| 36 * Set the {@link ContentIntentHandler} for {@link #starContentIntent}. | 37 * Set the {@link ContentIntentHandler} for {@link #starContentIntent}. |
| 37 * @param handler Handler to inject to {@link #startContentIntent}. | 38 * @param handler Handler to inject to {@link #startContentIntent}. |
| 38 */ | 39 */ |
| 39 public void setContentIntentHandler(ContentIntentHandler handler) { | 40 public void setContentIntentHandler(ContentIntentHandler handler) { |
| 41 Log.d("#YOLAND", "setting handler to be " + handler.toString()); |
| 40 mContentIntentHandler = handler; | 42 mContentIntentHandler = handler; |
| 41 } | 43 } |
| 42 | 44 |
| 45 public ContentIntentHandler getContentIntentHandler() { |
| 46 return mContentIntentHandler; |
| 47 } |
| 48 |
| 43 @Override | 49 @Override |
| 44 public void startContentIntent(Intent intent, String intentUrl, boolean isMa
inFrame) { | 50 public void startContentIntent(Intent intent, String intentUrl, boolean isMa
inFrame) { |
| 45 if (mContentIntentHandler != null) mContentIntentHandler.onIntentUrlRece
ived(intentUrl); | 51 if (mContentIntentHandler != null) mContentIntentHandler.onIntentUrlRece
ived(intentUrl); |
| 46 } | 52 } |
| 47 | 53 |
| 48 @Override | 54 @Override |
| 49 public ViewGroup getContainerView() { | 55 public ViewGroup getContainerView() { |
| 50 return mContainerView; | 56 return mContainerView; |
| 51 } | 57 } |
| 52 } | 58 } |
| OLD | NEW |