Commit 8d4dd86f authored by ianwen's avatar ianwen Committed by Commit bot

Add EnhancedBookmark Command Line flag in Java

Enhanced Bookmark feature may need to be turned on by some java
instrumental tests. Therefore the flag should be added to the java
command line class.

BUG=458632

Review URL: https://codereview.chromium.org/973283002

Cr-Commit-Position: refs/heads/master@{#319096}
parent 1e6cad36
...@@ -109,6 +109,12 @@ public abstract class ChromeSwitches { ...@@ -109,6 +109,12 @@ public abstract class ChromeSwitches {
/** Enable begin frame scheduling. */ /** Enable begin frame scheduling. */
public static final String ENABLE_BEGIN_FRAME_SCHEDULING = "enable-begin-frame-scheduling"; public static final String ENABLE_BEGIN_FRAME_SCHEDULING = "enable-begin-frame-scheduling";
/**
* Enable enhanced bookmarks feature.
* Native switch - switches::kEnhancedBookmarksExperiment
*/
public static final String ENABLE_ENHANCED_BOOKMARKS = "enhanced-bookmarks-experiment";
/** Enable the DOM Distiller. */ /** Enable the DOM Distiller. */
public static final String ENABLE_DOM_DISTILLER = "enable-dom-distiller"; public static final String ENABLE_DOM_DISTILLER = "enable-dom-distiller";
......
...@@ -544,8 +544,13 @@ public class BookmarksBridge { ...@@ -544,8 +544,13 @@ public class BookmarksBridge {
nativeEndGroupingUndos(mNativeBookmarksBridge); nativeEndGroupingUndos(mNativeBookmarksBridge);
} }
public static boolean isEditBookmarksEnabled(Profile profile) {
return nativeIsEditBookmarksEnabled(profile);
}
// TODO(ianwen): Remove this method after rolling.
public static boolean isEditBookmarksEnabled() { public static boolean isEditBookmarksEnabled() {
return nativeIsEditBookmarksEnabled(); return true;
} }
public static boolean isEnhancedBookmarksEnabled(Profile profile) { public static boolean isEnhancedBookmarksEnabled(Profile profile) {
...@@ -737,7 +742,7 @@ public class BookmarksBridge { ...@@ -737,7 +742,7 @@ public class BookmarksBridge {
private native long nativeInit(Profile profile); private native long nativeInit(Profile profile);
private native boolean nativeIsDoingExtensiveChanges(long nativeBookmarksBridge); private native boolean nativeIsDoingExtensiveChanges(long nativeBookmarksBridge);
private native void nativeDestroy(long nativeBookmarksBridge); private native void nativeDestroy(long nativeBookmarksBridge);
private static native boolean nativeIsEditBookmarksEnabled(); private static native boolean nativeIsEditBookmarksEnabled(Profile profile);
/** /**
* Simple object representing the bookmark item. * Simple object representing the bookmark item.
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/incognito_helpers.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_android.h" #include "chrome/browser/profiles/profile_android.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/undo/bookmark_undo_service.h" #include "chrome/browser/undo/bookmark_undo_service.h"
#include "chrome/browser/undo/bookmark_undo_service_factory.h" #include "chrome/browser/undo/bookmark_undo_service_factory.h"
...@@ -147,13 +146,15 @@ static jboolean IsEnhancedBookmarksFeatureEnabled(JNIEnv* env, ...@@ -147,13 +146,15 @@ static jboolean IsEnhancedBookmarksFeatureEnabled(JNIEnv* env,
return IsEnhancedBookmarksEnabled(profile->GetPrefs()); return IsEnhancedBookmarksEnabled(profile->GetPrefs());
} }
static bool IsEditBookmarksEnabled() { static bool IsEditBookmarksEnabled(Profile* profile) {
return ProfileManager::GetLastUsedProfile()->GetPrefs()->GetBoolean( return profile->GetPrefs()->GetBoolean(
bookmarks::prefs::kEditBookmarksEnabled); bookmarks::prefs::kEditBookmarksEnabled);
} }
static jboolean IsEditBookmarksEnabled(JNIEnv* env, jclass clazz) { static jboolean IsEditBookmarksEnabled(JNIEnv* env,
return IsEditBookmarksEnabled(); jclass clazz,
jobject j_profile) {
return IsEditBookmarksEnabled(ProfileAndroid::FromProfileAndroid(j_profile));
} }
void BookmarksBridge::LoadEmptyPartnerBookmarkShimForTesting(JNIEnv* env, void BookmarksBridge::LoadEmptyPartnerBookmarkShimForTesting(JNIEnv* env,
...@@ -808,7 +809,7 @@ bool BookmarksBridge::IsEditable(const BookmarkNode* node) const { ...@@ -808,7 +809,7 @@ bool BookmarksBridge::IsEditable(const BookmarkNode* node) const {
node->type() != BookmarkNode::URL)) { node->type() != BookmarkNode::URL)) {
return false; return false;
} }
if (!IsEditBookmarksEnabled()) if (!IsEditBookmarksEnabled(profile_))
return false; return false;
if (partner_bookmarks_shim_->IsPartnerBookmark(node)) if (partner_bookmarks_shim_->IsPartnerBookmark(node))
return partner_bookmarks_shim_->IsEditable(node); return partner_bookmarks_shim_->IsEditable(node);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment