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

Side by Side Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkDelegate.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.enhancedbookmarks;
6
7 import android.support.annotation.Nullable;
8 import android.support.v4.widget.DrawerLayout;
9 import android.view.View;
10
11 import org.chromium.chrome.browser.enhanced_bookmarks.EnhancedBookmarksModel;
12 import org.chromium.chrome.browser.enhanced_bookmarks.LaunchLocation;
13 import org.chromium.components.bookmarks.BookmarkId;
14
15 import java.util.List;
16
17 /**
18 * Interface used among EnhancedBookmark UI components to broadcast UI change no tifications and get
19 * bookmark data model.
20 */
21 interface EnhancedBookmarkDelegate {
22
23 /**
24 * Delegate used to open urls for main fragment on tablet.
25 */
26 interface EnhancedBookmarkStateChangeListener {
27 /**
28 * Let the tab containing bookmark manager load the url and later handle UI updates.
29 * @param url The url to open in tab.
30 */
31 public void onBookmarkUIStateChange(String url);
32 }
33
34 static final int STATE_LOADING = 0;
35 static final int STATE_ALL_BOOKMARKS = 1;
36 static final int STATE_FOLDER = 2;
37 static final int STATE_FILTER = 3;
38
39 /**
40 * Corresponds to "All Items" list item in the side drawer. Shows all bookma rks.
41 */
42 void openAllBookmarks();
43
44 /**
45 * Corresponds to any folder named list item in the side drawer. Shows bookm arks under the
46 * folder.
47 * @param folder Parent folder that contains bookmarks to show as its childr en.
48 */
49 void openFolder(BookmarkId folder);
50
51 /**
52 * Corresponds to any filter list item in the side drawer. Shows bookmarks u nder the
53 * filter.
54 * @param filter Filter string to search
55 */
56 void openFilter(String filter);
57
58 /**
59 * Clear all selected items. After this call, {@link #isSelectionEnabled()} will return false.
60 */
61 void clearSelection();
62
63 /**
64 * Toggle the selection state of a bookmark. If the given bookmark is not
65 * editable, it will take no effect.
66 * @return True if the bookmark is selected after toggling. False otherwise.
67 */
68 boolean toggleSelectionForBookmark(BookmarkId bookmark);
69
70 /**
71 * @return True if the bookmark is selected. False otherwise.
72 */
73 boolean isBookmarkSelected(BookmarkId bookmark);
74
75 /**
76 * @return Whether selection is happening.
77 */
78 boolean isSelectionEnabled();
79
80 /**
81 * @return The list of bookmarks that are currently selected by the user.
82 */
83 List<BookmarkId> getSelectedBookmarks();
84
85 /**
86 * Sets list mode. If the mode is toggles,
87 * {@link EnhancedBookmarkUIObserver#onListModeChange(boolean)} will be call ed.
88 */
89 void setListModeEnabled(boolean isListModeEnabled);
90
91 /**
92 * @return True is list mode is enabled. False otherwise.
93 */
94 boolean isListModeEnabled();
95
96 /**
97 * Notifies the current mode set event to the given observer. For example, i f the current mode
98 * is MODE_ALL_BOOKMARKS, it calls onAllBookmarksModeSet.
99 */
100 void notifyStateChange(EnhancedBookmarkUIObserver observer);
101
102 /**
103 * @return Whether there is a drawer.
104 */
105 boolean doesDrawerExist();
106
107 /**
108 * Close drawer if it's visible.
109 */
110 void closeDrawer();
111
112 /**
113 * @return The current drawer layout instance, if it exists.
114 */
115 DrawerLayout getDrawerLayout();
116
117 /**
118 * Closes the EnhancedBookmark UI (if on phone) and opens the given bookmark .
119 * @param bookmark bookmark to open.
120 * @param launchLocation The UI location where user tried to open bookmark. It is one of
121 * {@link LaunchLocation} values
122 */
123 void openBookmark(BookmarkId bookmark, int launchLocation);
124
125 /**
126 * Starts detail activity with shared element animation. On Lollipop and lat er devices, shows a
127 * shared image animation. On earlier devices, opens the activity using the standard Activity
128 * transition.
129 * @param bookmarkId The bookmark that the detail activity shows.
130 * @param view The view to share for activity transition animation. If null, no transition is
131 * displayed.
132 */
133 void startDetailActivity(BookmarkId bookmarkId, @Nullable View view);
134
135 /**
136 * Shows the search UI.
137 */
138 void openSearchUI();
139
140 /**
141 * Dismisses the search UI.
142 */
143 void closeSearchUI();
144
145 /**
146 * Closes the EnhancedBookmark Activity on Phone. Does nothing on tablet.
147 */
148 void finishActivityOnPhone();
149
150 /**
151 * Add an observer to enhanced bookmark UI changes.
152 */
153 void addUIObserver(EnhancedBookmarkUIObserver observer);
154
155 /**
156 * Remove an observer of enhanced bookmark UI changes.
157 */
158 void removeUIObserver(EnhancedBookmarkUIObserver observer);
159
160 /**
161 * @return Enhanced bookmark data model associated with this UI.
162 */
163 EnhancedBookmarksModel getModel();
164
165 /**
166 * @return Current UIState of Enhanced Bookmark main UI. If no mode is store d,
167 * {@link EnhancedBookmarkDelegate#STATE_LOADING} is returned.
168 */
169 int getCurrentState();
170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698