| Index: chrome/android/java/src/org/chromium/chrome/browser/tab/TabDelegateFactory.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabDelegateFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabDelegateFactory.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d25b879445a4ba59e79f6ca452aaaf2c4c153185
|
| --- /dev/null
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabDelegateFactory.java
|
| @@ -0,0 +1,58 @@
|
| +// Copyright 2015 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.chrome.browser.tab;
|
| +
|
| +import org.chromium.chrome.browser.ChromeActivity;
|
| +import org.chromium.chrome.browser.banners.AppBannerManager;
|
| +import org.chromium.chrome.browser.contextmenu.ChromeContextMenuPopulator;
|
| +import org.chromium.chrome.browser.contextmenu.ContextMenuPopulator;
|
| +import org.chromium.components.navigation_interception.InterceptNavigationDelegate;
|
| +import org.chromium.components.web_contents_delegate_android.WebContentsDelegateAndroid;
|
| +
|
| +/**
|
| + * A factory class to create {@link Tab} related delegates.
|
| + */
|
| +public class TabDelegateFactory {
|
| + /**
|
| + * Creates the web contents delegate the tab will be initialized with.
|
| + * @param tab The associated {@link Tab}.
|
| + * @param activity The {@link ChromeActivity} that the tab belongs to.
|
| + * @return The {@link WebContentsDelegateAndroid} to be used for this tab.
|
| + */
|
| + public TabWebContentsDelegateAndroid createWebContentsDelegate(
|
| + Tab tab, ChromeActivity activity) {
|
| + return new TabWebContentsDelegateAndroid(tab, activity);
|
| + }
|
| +
|
| + /**
|
| + * Creates the intercept navigation delegate the tab will be initialized with.
|
| + * @param tab The associated {@link Tab}.
|
| + * @param activity The {@link ChromeActivity} that the tab belongs to.
|
| + * @return The {@link InterceptNavigationDelegate} to be used for this tab.
|
| + */
|
| + public InterceptNavigationDelegateImpl createInterceptNavigationDelegate(
|
| + Tab tab, ChromeActivity activity) {
|
| + return new InterceptNavigationDelegateImpl(activity, tab);
|
| + }
|
| +
|
| + /**
|
| + * Creates the context menu populator the tab will be initialized with.
|
| + * @param tab The associated {@link Tab}.
|
| + * @param activity The {@link ChromeActivity} that the tab belongs to.
|
| + * @return The {@link ContextMenuPopulator} to be used for this tab.
|
| + */
|
| + public ContextMenuPopulator createContextMenuPopulator(Tab tab, ChromeActivity activity) {
|
| + return new ChromeContextMenuPopulator(new TabContextMenuItemDelegate(tab, activity));
|
| + }
|
| +
|
| + /**
|
| + * Creates the app banner manager the tab will be initialized with.
|
| + * @param tab The associated {@link Tab}.
|
| + * @return {@link AppBannerManager} to be used for the given tab. May be null.
|
| + */
|
| + public AppBannerManager createAppBannerManager(Tab tab) {
|
| + return new AppBannerManager(tab, tab.getApplicationContext());
|
| + }
|
| +}
|
|
|