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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tab/TabDelegateFactory.java

Issue 1416093004: Remove CustomTab and have all CustomTabActivity using Tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed clang build error Created 5 years, 2 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
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());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698