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

Unified Diff: chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellTabModelSelector.java

Issue 683203006: Adding option for adding new tab in tab manager for chrome shell. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes For Review Comments Created 6 years, 1 month 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 | « no previous file | chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellTabModelSelector.java
diff --git a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellTabModelSelector.java b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellTabModelSelector.java
index 3d54c086b832a7873bd96e2b499eed04e5c18a9f..28e3532c994101ee733b87fe24423dc265ef9988 100644
--- a/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellTabModelSelector.java
+++ b/chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellTabModelSelector.java
@@ -4,9 +4,7 @@
package org.chromium.chrome.shell;
-import android.view.LayoutInflater;
-import android.view.ViewGroup;
-import android.view.ViewParent;
+import android.content.Context;
import org.chromium.chrome.browser.Tab;
import org.chromium.chrome.browser.tabmodel.EmptyTabModel;
@@ -16,7 +14,6 @@ import org.chromium.chrome.browser.tabmodel.TabModel.TabSelectionType;
import org.chromium.chrome.browser.tabmodel.TabModelDelegate;
import org.chromium.chrome.browser.tabmodel.TabModelOrderController;
import org.chromium.chrome.browser.tabmodel.TabModelSelectorBase;
-import org.chromium.chrome.browser.widget.accessibility.AccessibilityTabModelWrapper;
import org.chromium.content.browser.ContentVideoViewClient;
import org.chromium.content.browser.ContentViewClient;
import org.chromium.content_public.browser.LoadUrlParams;
@@ -30,18 +27,17 @@ class ChromeShellTabModelSelector extends TabModelSelectorBase {
private final WindowAndroid mWindow;
private final ContentVideoViewClient mContentVideoViewClient;
- private final ViewGroup mParent;
+ private final Context mContext;
private final TabModelOrderController mOrderController;
- private AccessibilityTabModelWrapper mTabModelWrapper;
private TabManager mTabManager;
public ChromeShellTabModelSelector(
- WindowAndroid window, ContentVideoViewClient videoViewClient, ViewGroup parent,
+ WindowAndroid window, ContentVideoViewClient videoViewClient, Context context,
TabManager tabManager) {
mWindow = window;
mContentVideoViewClient = videoViewClient;
- mParent = parent;
+ mContext = context;
mOrderController = new TabModelOrderController(this);
mTabManager = tabManager;
@@ -68,7 +64,7 @@ class ChromeShellTabModelSelector extends TabModelSelectorBase {
@Override
public boolean isInOverviewMode() {
- return isTabSwitcherVisible();
+ return mTabManager.isTabSwitcherVisible();
}
@Override
@@ -96,7 +92,7 @@ class ChromeShellTabModelSelector extends TabModelSelectorBase {
}
};
ChromeShellTab tab = new ChromeShellTab(
- mParent.getContext(), loadUrlParams.getUrl(), mWindow, client, mTabManager);
+ mContext, loadUrlParams.getUrl(), mWindow, client, mTabManager);
int index = mOrderController.determineInsertionIndex(type, tab);
TabModel tabModel = getCurrentModel();
tabModel.addTab(tab, index, type);
@@ -104,44 +100,4 @@ class ChromeShellTabModelSelector extends TabModelSelectorBase {
return tab;
}
- /**
- * Toggles the tab switcher visibility.
- */
- public void toggleTabSwitcher() {
- if (!isTabSwitcherVisible()) {
- showTabSwitcher();
- } else {
- hideTabSwitcher();
- }
- }
-
- /*
- * Hide the tab switcher.
- */
- public void hideTabSwitcher() {
- if (mTabModelWrapper == null) return;
- ViewParent parent = mTabModelWrapper.getParent();
- if (parent != null) {
- assert parent == mParent;
- mParent.removeView(mTabModelWrapper);
- }
- }
-
- private void showTabSwitcher() {
- if (mTabModelWrapper == null) {
- mTabModelWrapper = (AccessibilityTabModelWrapper) LayoutInflater.from(
- mParent.getContext()).inflate(R.layout.accessibility_tab_switcher, null);
- mTabModelWrapper.setup(null);
- mTabModelWrapper.setTabModelSelector(this);
- }
-
- if (mTabModelWrapper.getParent() == null) {
- mParent.addView(mTabModelWrapper);
- }
- }
-
- public boolean isTabSwitcherVisible() {
- return mTabModelWrapper != null && mTabModelWrapper.getParent() == mParent;
- }
-
}
« no previous file with comments | « no previous file | chrome/android/shell/java/src/org/chromium/chrome/shell/ChromeShellToolbar.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698