| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.tabmodel.document; | 5 package org.chromium.chrome.browser.tabmodel.document; |
| 6 | 6 |
| 7 import android.app.Activity; | 7 import android.app.Activity; |
| 8 | 8 |
| 9 import org.chromium.chrome.browser.Tab; | 9 import org.chromium.chrome.browser.Tab; |
| 10 import org.chromium.chrome.browser.document.PendingDocumentData; | 10 import org.chromium.chrome.browser.tabmodel.TabCreatorManager.TabCreator; |
| 11 import org.chromium.chrome.browser.tabmodel.document.DocumentTabModel.Entry; | 11 import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; |
| 12 import org.chromium.content_public.browser.LoadUrlParams; | |
| 13 import org.chromium.content_public.browser.WebContents; | 12 import org.chromium.content_public.browser.WebContents; |
| 14 | 13 |
| 15 /** | 14 /** |
| 16 * Provides Tabs to a DocumentTabModel. | 15 * Provides Tabs to a DocumentTabModel. |
| 17 * TODO(dfalcantara): Make this a TabCreatorManager.TabCreator subclass. | |
| 18 */ | 16 */ |
| 19 public interface TabDelegate { | 17 public interface TabDelegate extends TabCreator { |
| 20 /** | 18 /** |
| 21 * Returns the Tab for the given Activity. | 19 * Returns the Tab for the given Activity. |
| 22 * @param incognito Whether the Activity is supposed to hold an incognito Ta
b. | 20 * @param delgate Stores information about DocumentActivities. |
| 23 * @param delgate Sotres information about DocumentActivities. | |
| 24 * @param activity Activity to grab the Tab of. | 21 * @param activity Activity to grab the Tab of. |
| 25 * @return Tab for the DocumentActivity, if it is a valid DocumentActivity.
Null otherwise. | 22 * @return Tab for the DocumentActivity, if it is a valid DocumentActivity.
Null otherwise. |
| 26 */ | 23 */ |
| 27 Tab getActivityTab(boolean incognito, ActivityDelegate delgate, Activity act
ivity); | 24 Tab getActivityTab(ActivityDelegate activityDelegate, Activity activity); |
| 28 | 25 |
| 29 /** | 26 /** |
| 30 * Opens a new Tab in the foreground. | 27 * Creates a Tab to host the given WebContents. |
| 31 * Assumed to be triggered by a window.open(). | 28 * @param webContents WebContents that has been pre-created. |
| 29 * @param parentId ID of the parent Tab. |
| 30 * @param type Launch type for the Tab. |
| 31 * @param startedBy See {@link DocumentMetricIds}. |
| 32 */ | 32 */ |
| 33 void createTabInForeground(Activity parentActivity, boolean incognito, | 33 Tab createTabWithWebContents( |
| 34 LoadUrlParams loadUrlParams, PendingDocumentData documentParams); | 34 WebContents webContents, int parentId, TabLaunchType type, int start
edBy); |
| 35 | |
| 36 /** | |
| 37 * Creates a frozen Tab for the Entry. This Tab is not meant to be used or
unfrozen -- it is | |
| 38 * only used as a placeholder until the real Tab can be created. | |
| 39 * @param entry Entry containing TabState. | |
| 40 * @return A frozen Tab. | |
| 41 */ | |
| 42 Tab createFrozenTab(Entry entry); | |
| 43 | |
| 44 /** | |
| 45 * Creates a new Activity for the pre-created WebContents. | |
| 46 * @param isIncognito Whether the Activity is supposed to hold an incognito
Tab. | |
| 47 * @param webContents WebContents to use with the new Tab. | |
| 48 * @param parentTabId ID of the spawning Tab. | |
| 49 */ | |
| 50 void createTabWithWebContents(boolean isIncognito, WebContents webContents,
int parentTabId); | |
| 51 | |
| 52 /** | |
| 53 * Creates a new Tab for a URL typed into DevTools. | |
| 54 * @param url URL to spawn a Tab for. | |
| 55 */ | |
| 56 void createTabForDevTools(String url); | |
| 57 } | 35 } |
| OLD | NEW |