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

Side by Side Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/document/TabDelegateImpl.java

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.document;
6
7 import android.app.Activity;
8
9 import org.chromium.chrome.browser.Tab;
10 import org.chromium.chrome.browser.TabState;
11 import org.chromium.chrome.browser.tab.ChromeTab;
12 import org.chromium.chrome.browser.tabmodel.document.ActivityDelegate;
13 import org.chromium.chrome.browser.tabmodel.document.DocumentTabModel.Entry;
14 import org.chromium.chrome.browser.tabmodel.document.TabDelegate;
15 import org.chromium.content_public.browser.LoadUrlParams;
16 import org.chromium.content_public.browser.WebContents;
17 import org.chromium.ui.base.PageTransition;
18
19 /**
20 * Provides Tabs to a DocumentTabModel.
21 * TODO(dfalcantara): delete or refactor this after upstreaming.
22 */
23 public class TabDelegateImpl implements TabDelegate {
24 @Override
25 public Tab getActivityTab(
26 boolean incognito, ActivityDelegate activityDelegate, Activity activ ity) {
27 if (!(activity instanceof DocumentActivity)
28 || !activityDelegate.isValidActivity(incognito, activity.getInte nt())) return null;
29 return ((DocumentActivity) activity).getActivityTab();
30 }
31
32 @Override
33 public void createTabInForeground(Activity parentActivity, boolean incognito ,
34 LoadUrlParams loadUrlParams, PendingDocumentData documentParams) {
35 ChromeLauncherActivity.launchDocumentInstance(parentActivity, incognito,
36 ChromeLauncherActivity.LAUNCH_MODE_FOREGROUND, loadUrlParams.get Url(),
37 DocumentMetricIds.STARTED_BY_WINDOW_OPEN,
38 loadUrlParams.getTransitionType(), false, documentParams);
39 }
40
41 @Override
42 public Tab createFrozenTab(Entry entry) {
43 TabState state = entry.getTabState();
44 assert state != null;
45 return ChromeTab.createFrozenTabFromState(entry.tabId, null, state.isInc ognito(), null,
46 Tab.INVALID_TAB_ID, state);
47 }
48
49 @Override
50 public void createTabWithWebContents(
51 boolean isIncognito, WebContents webContents, int parentTabId) {
52 PendingDocumentData data = new PendingDocumentData();
53 data.webContents = webContents;
54 ChromeLauncherActivity.launchDocumentInstance(
55 null, isIncognito, ChromeLauncherActivity.LAUNCH_MODE_FOREGROUND , null,
56 DocumentMetricIds.STARTED_BY_CHROME_HOME_RECENT_TABS,
57 PageTransition.RELOAD, false, data);
58 }
59
60 @Override
61 public void createTabForDevTools(String url) {
62 ChromeLauncherActivity.launchDocumentInstance(
63 null, false, ChromeLauncherActivity.LAUNCH_MODE_FOREGROUND, url,
64 DocumentMetricIds.STARTED_BY_CHROME_HOME_RECENT_TABS,
65 PageTransition.RELOAD, false, null);
66 }
67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698