| Index: chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java
|
| similarity index 91%
|
| rename from chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUtils.java
|
| rename to chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java
|
| index 25b44421648a81f1cfcdc14640d5e539654bd365..761eb4ac922988b80df7ac28afaa42c6ee84ef3b 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/enhancedbookmarks/EnhancedBookmarkUtils.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java
|
| @@ -2,7 +2,7 @@
|
| // 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;
|
| +package org.chromium.chrome.browser.bookmarks;
|
|
|
| import android.app.Activity;
|
| import android.content.Context;
|
| @@ -22,8 +22,8 @@ import org.chromium.chrome.R;
|
| import org.chromium.chrome.browser.ChromeBrowserProviderClient;
|
| import org.chromium.chrome.browser.IntentHandler;
|
| import org.chromium.chrome.browser.UrlConstants;
|
| +import org.chromium.chrome.browser.bookmarks.BookmarksModel.AddBookmarkCallback;
|
| import org.chromium.chrome.browser.document.ChromeLauncherActivity;
|
| -import org.chromium.chrome.browser.enhancedbookmarks.EnhancedBookmarksModel.AddBookmarkCallback;
|
| import org.chromium.chrome.browser.ntp.NewTabPageUma;
|
| import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
|
| import org.chromium.chrome.browser.offlinepages.OfflinePageFreeUpSpaceCallback;
|
| @@ -44,12 +44,12 @@ import org.chromium.ui.base.DeviceFormFactor;
|
| /**
|
| * A class holding static util functions for enhanced bookmark.
|
| */
|
| -public class EnhancedBookmarkUtils {
|
| +public class BookmarkUtils {
|
| private static final String PREF_LAST_USED_URL = "enhanced_bookmark_last_used_url";
|
| private static final String PREF_LAST_USED_PARENT = "enhanced_bookmark_last_used_parent_folder";
|
|
|
| /**
|
| - * If the tab has already been bookmarked, start {@link EnhancedBookmarkEditActivity} for the
|
| + * If the tab has already been bookmarked, start {@link BookmarkEditActivity} for the
|
| * bookmark. If not, add the bookmark to bookmarkmodel, and show a snackbar notifying the user.
|
| * @param idToAdd The bookmark ID if the tab has already been bookmarked.
|
| * @param bookmarkModel The enhanced bookmark model.
|
| @@ -57,7 +57,7 @@ public class EnhancedBookmarkUtils {
|
| * @param snackbarManager The SnackbarManager used to show the snackbar.
|
| * @param activity Current activity.
|
| */
|
| - public static void addOrEditBookmark(long idToAdd, EnhancedBookmarksModel bookmarkModel,
|
| + public static void addOrEditBookmark(long idToAdd, BookmarksModel bookmarkModel,
|
| Tab tab, SnackbarManager snackbarManager, Activity activity) {
|
| // See if the Tab's contents should be saved or not.
|
| WebContents webContentsToSave = null;
|
| @@ -87,7 +87,7 @@ public class EnhancedBookmarkUtils {
|
| * @param url The URL of the new bookmark.
|
| */
|
| public static BookmarkId addBookmarkSilently(Context context,
|
| - EnhancedBookmarksModel bookmarkModel, String title, String url) {
|
| + BookmarksModel bookmarkModel, String title, String url) {
|
| BookmarkId parent = getLastUsedParent(context);
|
| if (parent == null || !bookmarkModel.doesBookmarkExist(parent)) {
|
| parent = bookmarkModel.getDefaultFolder();
|
| @@ -105,7 +105,7 @@ public class EnhancedBookmarkUtils {
|
| * @param snackbarManager The SnackbarManager used to show the snackbar.
|
| * @param activity Current activity.
|
| */
|
| - public static void saveBookmarkOffline(long id, EnhancedBookmarksModel bookmarkModel,
|
| + public static void saveBookmarkOffline(long id, BookmarksModel bookmarkModel,
|
| Tab tab, final SnackbarManager snackbarManager, Activity activity) {
|
| assert id != ChromeBrowserProviderClient.INVALID_BOOKMARK_ID;
|
| BookmarkId bookmarkId = new BookmarkId(id, BookmarkType.NORMAL);
|
| @@ -124,7 +124,7 @@ public class EnhancedBookmarkUtils {
|
| createAddBookmarkCallback(bookmarkModel, snackbarManager, activity));
|
| }
|
|
|
| - private static void showSnackbarForAddingBookmark(final EnhancedBookmarksModel bookmarkModel,
|
| + private static void showSnackbarForAddingBookmark(final BookmarksModel bookmarkModel,
|
| final SnackbarManager snackbarManager, final Activity activity,
|
| final BookmarkId bookmarkId, final int saveResult, boolean isStorageAlmostFull) {
|
| Snackbar snackbar;
|
| @@ -191,7 +191,7 @@ public class EnhancedBookmarkUtils {
|
| }
|
|
|
| private static AddBookmarkCallback createAddBookmarkCallback(
|
| - final EnhancedBookmarksModel bookmarkModel, final SnackbarManager snackbarManager,
|
| + final BookmarksModel bookmarkModel, final SnackbarManager snackbarManager,
|
| final Activity activity) {
|
| return new AddBookmarkCallback() {
|
| @Override
|
| @@ -227,7 +227,7 @@ public class EnhancedBookmarkUtils {
|
| * created bookmark.
|
| */
|
| private static SnackbarController createSnackbarControllerForEditButton(
|
| - final EnhancedBookmarksModel bookmarkModel, final Activity activity,
|
| + final BookmarksModel bookmarkModel, final Activity activity,
|
| final BookmarkId bookmarkId) {
|
| return new SnackbarController() {
|
|
|
| @@ -252,7 +252,7 @@ public class EnhancedBookmarkUtils {
|
| * space taken by the offline pages.
|
| */
|
| private static SnackbarController createSnackbarControllerForFreeUpSpaceButton(
|
| - final EnhancedBookmarksModel bookmarkModel, final SnackbarManager snackbarManager,
|
| + final BookmarksModel bookmarkModel, final SnackbarManager snackbarManager,
|
| final Activity activity) {
|
| return new SnackbarController() {
|
| @Override
|
| @@ -295,7 +295,7 @@ public class EnhancedBookmarkUtils {
|
| /**
|
| * Gets whether bookmark manager should load offline page initially.
|
| */
|
| - private static boolean shouldShowOfflinePageAtFirst(EnhancedBookmarksModel model,
|
| + private static boolean shouldShowOfflinePageAtFirst(BookmarksModel model,
|
| Context context) {
|
| OfflinePageBridge bridge = model.getOfflinePageBridge();
|
| if (bridge == null || bridge.getAllPages().isEmpty()
|
| @@ -314,7 +314,7 @@ public class EnhancedBookmarkUtils {
|
| if (DeviceFormFactor.isTablet(activity)) {
|
| openUrl(activity, url);
|
| } else {
|
| - Intent intent = new Intent(activity, EnhancedBookmarkActivity.class);
|
| + Intent intent = new Intent(activity, BookmarkActivity.class);
|
| intent.setData(Uri.parse(url));
|
| activity.startActivity(intent);
|
| }
|
| @@ -325,10 +325,10 @@ public class EnhancedBookmarkUtils {
|
| * experiments we run.
|
| */
|
| private static String getFirstUrlToLoad(Activity activity) {
|
| - EnhancedBookmarksModel model = new EnhancedBookmarksModel();
|
| + BookmarksModel model = new BookmarksModel();
|
| try {
|
| if (shouldShowOfflinePageAtFirst(model, activity)) {
|
| - return EnhancedBookmarkUIState.createFilterUrl(EnhancedBookmarkFilter.OFFLINE_PAGES,
|
| + return BookmarkUIState.createFilterUrl(BookmarkFilter.OFFLINE_PAGES,
|
| false).toString();
|
| }
|
| String lastUsedUrl = getLastUsedUrl(activity);
|
| @@ -378,21 +378,21 @@ public class EnhancedBookmarkUtils {
|
| }
|
|
|
| /**
|
| - * Starts an {@link EnhancedBookmarkEditActivity} for the given {@link BookmarkId}.
|
| + * Starts an {@link BookmarkEditActivity} for the given {@link BookmarkId}.
|
| * If the given {@link WebContents} is null, an option to visit the page is shown
|
| * as opposed to showing an option to directly save the page
|
| * (only if offline pages are enabled).
|
| */
|
| public static void startEditActivity(
|
| Context context, BookmarkId bookmarkId, WebContents webContents) {
|
| - Intent intent = new Intent(context, EnhancedBookmarkEditActivity.class);
|
| - intent.putExtra(EnhancedBookmarkEditActivity.INTENT_BOOKMARK_ID, bookmarkId.toString());
|
| + Intent intent = new Intent(context, BookmarkEditActivity.class);
|
| + intent.putExtra(BookmarkEditActivity.INTENT_BOOKMARK_ID, bookmarkId.toString());
|
| if (webContents != null) {
|
| - intent.putExtra(EnhancedBookmarkEditActivity.INTENT_WEB_CONTENTS, webContents);
|
| + intent.putExtra(BookmarkEditActivity.INTENT_WEB_CONTENTS, webContents);
|
| }
|
| - if (context instanceof EnhancedBookmarkActivity) {
|
| - ((EnhancedBookmarkActivity) context).startActivityForResult(
|
| - intent, EnhancedBookmarkActivity.EDIT_BOOKMARK_REQUEST_CODE);
|
| + if (context instanceof BookmarkActivity) {
|
| + ((BookmarkActivity) context).startActivityForResult(
|
| + intent, BookmarkActivity.EDIT_BOOKMARK_REQUEST_CODE);
|
| } else {
|
| context.startActivity(intent);
|
| }
|
| @@ -406,7 +406,7 @@ public class EnhancedBookmarkUtils {
|
| * @param launchLocation Location from which the bookmark is being opened.
|
| * @return Whether the bookmark was successfully opened.
|
| */
|
| - public static boolean openBookmark(EnhancedBookmarksModel model, Activity activity,
|
| + public static boolean openBookmark(BookmarksModel model, Activity activity,
|
| BookmarkId bookmarkId, int launchLocation) {
|
| if (model.getBookmarkById(bookmarkId) == null) return false;
|
|
|
| @@ -452,7 +452,7 @@ public class EnhancedBookmarkUtils {
|
| * Closes the EnhancedBookmark Activity on Phone. Does nothing on tablet.
|
| */
|
| public static void finishActivityOnPhone(Context context) {
|
| - if (context instanceof EnhancedBookmarkActivity) {
|
| + if (context instanceof BookmarkActivity) {
|
| ((Activity) context).finish();
|
| }
|
| }
|
|
|