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 90% |
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 90d2641468c7f2f57332f38c553dff8b65ec3b56..1d8032b46b14979c689705c7678752917a55a07f 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.BookmarkModel.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, BookmarkModel bookmarkModel, |
Tab tab, SnackbarManager snackbarManager, Activity activity) { |
// See if the Tab's contents should be saved or not. |
WebContents webContentsToSave = null; |
@@ -88,7 +88,7 @@ public class EnhancedBookmarkUtils { |
* @param url The URL of the new bookmark. |
*/ |
public static BookmarkId addBookmarkSilently(Context context, |
- EnhancedBookmarksModel bookmarkModel, String title, String url) { |
+ BookmarkModel bookmarkModel, String title, String url) { |
BookmarkId parent = getLastUsedParent(context); |
if (parent == null || !bookmarkModel.doesBookmarkExist(parent)) { |
parent = bookmarkModel.getDefaultFolder(); |
@@ -106,7 +106,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, BookmarkModel bookmarkModel, |
Tab tab, final SnackbarManager snackbarManager, Activity activity) { |
assert id != ChromeBrowserProviderClient.INVALID_BOOKMARK_ID; |
BookmarkId bookmarkId = new BookmarkId(id, BookmarkType.NORMAL); |
@@ -126,7 +126,7 @@ public class EnhancedBookmarkUtils { |
tab.getWebContents())); |
} |
- private static void showSnackbarForAddingBookmark(final EnhancedBookmarksModel bookmarkModel, |
+ private static void showSnackbarForAddingBookmark(final BookmarkModel bookmarkModel, |
final SnackbarManager snackbarManager, final Activity activity, |
final BookmarkId bookmarkId, final int saveResult, boolean isStorageAlmostFull, |
final WebContents webContents) { |
@@ -195,7 +195,7 @@ public class EnhancedBookmarkUtils { |
} |
private static AddBookmarkCallback createAddBookmarkCallback( |
- final EnhancedBookmarksModel bookmarkModel, final SnackbarManager snackbarManager, |
+ final BookmarkModel bookmarkModel, final SnackbarManager snackbarManager, |
final Activity activity, final WebContents webContents) { |
return new AddBookmarkCallback() { |
@Override |
@@ -231,7 +231,7 @@ public class EnhancedBookmarkUtils { |
* created bookmark. |
*/ |
private static SnackbarController createSnackbarControllerForEditButton( |
- final EnhancedBookmarksModel bookmarkModel, final Activity activity, |
+ final BookmarkModel bookmarkModel, final Activity activity, |
final BookmarkId bookmarkId) { |
return new SnackbarController() { |
@@ -256,7 +256,7 @@ public class EnhancedBookmarkUtils { |
* space taken by the offline pages. |
*/ |
private static SnackbarController createSnackbarControllerForFreeUpSpaceButton( |
- final EnhancedBookmarksModel bookmarkModel, final SnackbarManager snackbarManager, |
+ final BookmarkModel bookmarkModel, final SnackbarManager snackbarManager, |
final Activity activity) { |
return new SnackbarController() { |
@Override |
@@ -299,8 +299,7 @@ public class EnhancedBookmarkUtils { |
/** |
* Gets whether bookmark manager should load offline page initially. |
*/ |
- private static boolean shouldShowOfflinePageAtFirst(EnhancedBookmarksModel model, |
- Context context) { |
+ private static boolean shouldShowOfflinePageAtFirst(BookmarkModel model, Context context) { |
OfflinePageBridge bridge = model.getOfflinePageBridge(); |
if (bridge == null || bridge.getAllPages().isEmpty() |
|| OfflinePageUtils.isConnected(context)) { |
@@ -318,7 +317,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); |
} |
@@ -329,10 +328,10 @@ public class EnhancedBookmarkUtils { |
* experiments we run. |
*/ |
private static String getFirstUrlToLoad(Activity activity) { |
- EnhancedBookmarksModel model = new EnhancedBookmarksModel(); |
+ BookmarkModel model = new BookmarkModel(); |
try { |
if (shouldShowOfflinePageAtFirst(model, activity)) { |
- return EnhancedBookmarkUIState.createFilterUrl(EnhancedBookmarkFilter.OFFLINE_PAGES, |
+ return BookmarkUIState.createFilterUrl(BookmarkFilter.OFFLINE_PAGES, |
false).toString(); |
} |
String lastUsedUrl = getLastUsedUrl(activity); |
@@ -382,21 +381,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); |
} |
@@ -410,7 +409,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(BookmarkModel model, Activity activity, |
BookmarkId bookmarkId, int launchLocation) { |
if (model.getBookmarkById(bookmarkId) == null) return false; |
@@ -456,7 +455,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(); |
} |
} |