| Index: chrome/android/java_staging/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkDelegate.java
|
| diff --git a/chrome/android/java_staging/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkDelegate.java b/chrome/android/java_staging/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkDelegate.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fda2878df480146559ea5fe7e917cbbf0b79e844
|
| --- /dev/null
|
| +++ b/chrome/android/java_staging/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkDelegate.java
|
| @@ -0,0 +1,170 @@
|
| +// 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.enhancedbookmarks;
|
| +
|
| +import android.support.annotation.Nullable;
|
| +import android.support.v4.widget.DrawerLayout;
|
| +import android.view.View;
|
| +
|
| +import org.chromium.chrome.browser.enhanced_bookmarks.EnhancedBookmarksModel;
|
| +import org.chromium.chrome.browser.enhanced_bookmarks.LaunchLocation;
|
| +import org.chromium.components.bookmarks.BookmarkId;
|
| +
|
| +import java.util.List;
|
| +
|
| +/**
|
| + * Interface used among EnhancedBookmark UI components to broadcast UI change notifications and get
|
| + * bookmark data model.
|
| + */
|
| +interface EnhancedBookmarkDelegate {
|
| +
|
| + /**
|
| + * Delegate used to open urls for main fragment on tablet.
|
| + */
|
| + interface EnhancedBookmarkStateChangeListener {
|
| + /**
|
| + * Let the tab containing bookmark manager load the url and later handle UI updates.
|
| + * @param url The url to open in tab.
|
| + */
|
| + public void onBookmarkUIStateChange(String url);
|
| + }
|
| +
|
| + static final int STATE_LOADING = 0;
|
| + static final int STATE_ALL_BOOKMARKS = 1;
|
| + static final int STATE_FOLDER = 2;
|
| + static final int STATE_FILTER = 3;
|
| +
|
| + /**
|
| + * Corresponds to "All Items" list item in the side drawer. Shows all bookmarks.
|
| + */
|
| + void openAllBookmarks();
|
| +
|
| + /**
|
| + * Corresponds to any folder named list item in the side drawer. Shows bookmarks under the
|
| + * folder.
|
| + * @param folder Parent folder that contains bookmarks to show as its children.
|
| + */
|
| + void openFolder(BookmarkId folder);
|
| +
|
| + /**
|
| + * Corresponds to any filter list item in the side drawer. Shows bookmarks under the
|
| + * filter.
|
| + * @param filter Filter string to search
|
| + */
|
| + void openFilter(String filter);
|
| +
|
| + /**
|
| + * Clear all selected items. After this call, {@link #isSelectionEnabled()} will return false.
|
| + */
|
| + void clearSelection();
|
| +
|
| + /**
|
| + * Toggle the selection state of a bookmark. If the given bookmark is not
|
| + * editable, it will take no effect.
|
| + * @return True if the bookmark is selected after toggling. False otherwise.
|
| + */
|
| + boolean toggleSelectionForBookmark(BookmarkId bookmark);
|
| +
|
| + /**
|
| + * @return True if the bookmark is selected. False otherwise.
|
| + */
|
| + boolean isBookmarkSelected(BookmarkId bookmark);
|
| +
|
| + /**
|
| + * @return Whether selection is happening.
|
| + */
|
| + boolean isSelectionEnabled();
|
| +
|
| + /**
|
| + * @return The list of bookmarks that are currently selected by the user.
|
| + */
|
| + List<BookmarkId> getSelectedBookmarks();
|
| +
|
| + /**
|
| + * Sets list mode. If the mode is toggles,
|
| + * {@link EnhancedBookmarkUIObserver#onListModeChange(boolean)} will be called.
|
| + */
|
| + void setListModeEnabled(boolean isListModeEnabled);
|
| +
|
| + /**
|
| + * @return True is list mode is enabled. False otherwise.
|
| + */
|
| + boolean isListModeEnabled();
|
| +
|
| + /**
|
| + * Notifies the current mode set event to the given observer. For example, if the current mode
|
| + * is MODE_ALL_BOOKMARKS, it calls onAllBookmarksModeSet.
|
| + */
|
| + void notifyStateChange(EnhancedBookmarkUIObserver observer);
|
| +
|
| + /**
|
| + * @return Whether there is a drawer.
|
| + */
|
| + boolean doesDrawerExist();
|
| +
|
| + /**
|
| + * Close drawer if it's visible.
|
| + */
|
| + void closeDrawer();
|
| +
|
| + /**
|
| + * @return The current drawer layout instance, if it exists.
|
| + */
|
| + DrawerLayout getDrawerLayout();
|
| +
|
| + /**
|
| + * Closes the EnhancedBookmark UI (if on phone) and opens the given bookmark.
|
| + * @param bookmark bookmark to open.
|
| + * @param launchLocation The UI location where user tried to open bookmark. It is one of
|
| + * {@link LaunchLocation} values
|
| + */
|
| + void openBookmark(BookmarkId bookmark, int launchLocation);
|
| +
|
| + /**
|
| + * Starts detail activity with shared element animation. On Lollipop and later devices, shows a
|
| + * shared image animation. On earlier devices, opens the activity using the standard Activity
|
| + * transition.
|
| + * @param bookmarkId The bookmark that the detail activity shows.
|
| + * @param view The view to share for activity transition animation. If null, no transition is
|
| + * displayed.
|
| + */
|
| + void startDetailActivity(BookmarkId bookmarkId, @Nullable View view);
|
| +
|
| + /**
|
| + * Shows the search UI.
|
| + */
|
| + void openSearchUI();
|
| +
|
| + /**
|
| + * Dismisses the search UI.
|
| + */
|
| + void closeSearchUI();
|
| +
|
| + /**
|
| + * Closes the EnhancedBookmark Activity on Phone. Does nothing on tablet.
|
| + */
|
| + void finishActivityOnPhone();
|
| +
|
| + /**
|
| + * Add an observer to enhanced bookmark UI changes.
|
| + */
|
| + void addUIObserver(EnhancedBookmarkUIObserver observer);
|
| +
|
| + /**
|
| + * Remove an observer of enhanced bookmark UI changes.
|
| + */
|
| + void removeUIObserver(EnhancedBookmarkUIObserver observer);
|
| +
|
| + /**
|
| + * @return Enhanced bookmark data model associated with this UI.
|
| + */
|
| + EnhancedBookmarksModel getModel();
|
| +
|
| + /**
|
| + * @return Current UIState of Enhanced Bookmark main UI. If no mode is stored,
|
| + * {@link EnhancedBookmarkDelegate#STATE_LOADING} is returned.
|
| + */
|
| + int getCurrentState();
|
| +}
|
|
|