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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/document/DocumentTabDelegateFactory.java

Issue 1506273004: Remove DocumentTab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unfreeze logic Created 5 years 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/document/DocumentTabDelegateFactory.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentTabDelegateFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentTabDelegateFactory.java
new file mode 100644
index 0000000000000000000000000000000000000000..7a9907b41b98c05919e7e46c8f25ed0c4e31af68
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentTabDelegateFactory.java
@@ -0,0 +1,46 @@
+// 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.document;
+
+import org.chromium.chrome.browser.ChromeActivity;
+import org.chromium.chrome.browser.ChromeApplication;
+import org.chromium.chrome.browser.tab.Tab;
+import org.chromium.chrome.browser.tab.TabDelegateFactory;
+import org.chromium.chrome.browser.tab.TabWebContentsDelegateAndroid;
+import org.chromium.chrome.browser.tabmodel.TabModel;
+
+/**
+ * A {@link TabDelegateFactory} class to be used in all {@link Tab} owned
+ * by a {@link DocumentActivity}.
+ */
+public class DocumentTabDelegateFactory extends TabDelegateFactory {
+ /**
+ * A web contents delegate for handling opening new windows in Document mode.
+ */
+ private static class DocumentTabWebContentsDelegateAndroid
+ extends TabWebContentsDelegateAndroid {
+ private boolean mIsIncognito;
+
+ public DocumentTabWebContentsDelegateAndroid(Tab tab, ChromeActivity activity) {
+ super(tab, activity);
+ mIsIncognito = tab.isIncognito();
+ }
+
+ /**
+ * TODO(dfalcantara): Remove this when DocumentActivity.getTabModelSelector()
+ * can return a TabModelSelector that activateContents() can use.
+ */
+ @Override
+ protected TabModel getTabModel() {
+ return ChromeApplication.getDocumentTabModelSelector().getModel(mIsIncognito);
+ }
+ }
+
+ @Override
+ public TabWebContentsDelegateAndroid createWebContentsDelegate(
+ Tab tab, ChromeActivity activity) {
+ return new DocumentTabWebContentsDelegateAndroid(tab, activity);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698