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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModel.java

Issue 1710213002: Consolidate/clarify TabLaunchTypes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing Created 4 years, 10 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
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; 5 package org.chromium.chrome.browser.tabmodel;
6 6
7 import org.chromium.chrome.browser.profiles.Profile; 7 import org.chromium.chrome.browser.profiles.Profile;
8 import org.chromium.chrome.browser.tab.Tab; 8 import org.chromium.chrome.browser.tab.Tab;
9 9
10 /** 10 /**
11 * TabModel organizes all the open tabs and allows you to create new ones. There are two TabModels 11 * TabModel organizes all the open tabs and allows you to create new ones. Regu lar and Incognito
12 * in the app at this time: normal and incognito. More could be added to allow f or windows or 12 * tabs are kept in different TabModels.
13 * something.
14 */ 13 */
15 public interface TabModel extends TabList { 14 public interface TabModel extends TabList {
16 /** 15 /**
17 * A list of the various ways tabs can be launched. 16 * A list of the various ways tabs can be launched.
18 */ 17 */
19 public enum TabLaunchType { 18 public enum TabLaunchType {
20 FROM_LINK, // Opened from a link. 19 /**
21 FROM_EXTERNAL_APP, // Opened by and external app. 20 * Opened from a link. Sets up a relationship between the newly created tab and its parent.
22 FROM_MENU_OR_OVERVIEW, // Opened from the options menu or the tab stack overview. 21 */
23 FROM_RESTORE, // Opened after restoring state from storage. 22 FROM_LINK,
24 // Opened from the long press menu. Like FROM_MENU but also sets up a pa rent/child 23
25 // relationship like FROM_LINK. FOREGROUND and BACKGROUND indicates whet her the current tab 24 /** Opened by an external app. */
26 // should be automatically switched to the new tab or not. 25 FROM_EXTERNAL_APP,
26
27 /**
28 * Catch-all for Tabs opened by Chrome UI not covered by more specific T abLaunchTypes.
29 * Examples include:
30 * - Tabs created by the options menu.
31 * - Tabs created via the New Tab button in the tab stack overview.
32 * - Tabs created via Push Notifications.
33 * - Tabs opened via a keyboard shortcut.
34 */
35 FROM_CHROME_UI,
36
37 /** Opened during the restoration process on startup. */
38 FROM_RESTORE,
39
40 /**
41 * Opened from the long press context menu. Will be brought to the fore ground.
42 * Like FROM_CHROME_UI, but also sets up a parent/child relationship lik e FROM_LINK.
43 */
27 FROM_LONGPRESS_FOREGROUND, 44 FROM_LONGPRESS_FOREGROUND,
28 FROM_LONGPRESS_BACKGROUND, 45
29 FROM_INSTANT, // Tab was created by instant. 46 /**
30 FROM_KEYBOARD // Opened from a physical keyboard via shortcut. 47 * Opened from the long press context menu. Will not be brought to the foreground.
48 * Like FROM_CHROME_UI, but also sets up a parent/child relationship lik e FROM_LINK.
49 */
50 FROM_LONGPRESS_BACKGROUND
31 } 51 }
32 52
33 /** 53 /**
34 * A list of the various ways tabs can eb selected. 54 * A list of the various ways tabs can be selected.
35 */ 55 */
36 public enum TabSelectionType { 56 public enum TabSelectionType {
37 FROM_CLOSE, // Selection of adjacent tab when the active tab is closed i n foreground. 57 /** Selection of adjacent tab when the active tab is closed in foregroun d. */
38 FROM_EXIT, // Selection of adjacent tab when the active tab is closed u pon app exit. 58 FROM_CLOSE,
39 FROM_NEW, // Selection of newly created tab (e.g. for a url intent or NTP). 59
40 FROM_USER // User-originated switch to existing tab or selection of ma in tab on app 60 /** Selection of adjacent tab when the active tab is closed upon app exi t. */
41 // startup. 61 FROM_EXIT,
62
63 /** Selection of newly created tab (e.g. for a URL intent or NTP). */
64 FROM_NEW,
65
66 /** User-originated switch to existing tab or selection of main tab on a pp startup. */
67 FROM_USER
42 } 68 }
43 69
44 /** 70 /**
45 * @return The profile associated with the current model. 71 * @return The profile associated with the current model.
46 */ 72 */
47 public Profile getProfile(); 73 public Profile getProfile();
48 74
49 /** 75 /**
50 * Unregisters and destroys the specified tab, and then switches to the prev ious tab. 76 * Unregisters and destroys the specified tab, and then switches to the prev ious tab.
51 * @param tab The non-null tab to close 77 * @param tab The non-null tab to close
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 * @param observer The observer to be subscribed. 185 * @param observer The observer to be subscribed.
160 */ 186 */
161 void addObserver(TabModelObserver observer); 187 void addObserver(TabModelObserver observer);
162 188
163 /** 189 /**
164 * Unsubscribes a previously subscribed {@link TabModelObserver}. 190 * Unsubscribes a previously subscribed {@link TabModelObserver}.
165 * @param observer The observer to be unsubscribed. 191 * @param observer The observer to be unsubscribed.
166 */ 192 */
167 void removeObserver(TabModelObserver observer); 193 void removeObserver(TabModelObserver observer);
168 } 194 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698