Commit 19c5eafc authored by yusufo@chromium.org's avatar yusufo@chromium.org

Add prefs for collapsed currently open tabs group in new tab page

BUG=389697

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284309 0039d316-1c4b-4281-b951-d872f2087c98
parent fd1bbd8e
...@@ -31,67 +31,90 @@ public class NewTabPagePrefs { ...@@ -31,67 +31,90 @@ public class NewTabPagePrefs {
} }
/** /**
* Set snapshot document list collapsed or uncollapsed state in preferences. * Sets whether the list of currently open tabs is collapsed (vs expanded) on the Recent Tabs
* @param isCollapsed {@code True} Whether we want the snapshot documents list to be collapsed. * page.
* @param isCollapsed Whether we want the currently open tabs list to be collapsed.
*/
public void setCurrentlyOpenTabsCollapsed(boolean isCollapsed) {
nativeSetCurrentlyOpenTabsCollapsed(mNativeNewTabPagePrefs, isCollapsed);
}
/**
* Gets whether the list of currently open tabs is collapsed (vs expanded) on Recent Tabs page.
* @return Whether the list of currently open tabs is collapsed (vs expanded) on
* the Recent Tabs page.
*/
public boolean getCurrentlyOpenTabsCollapsed() {
return nativeGetCurrentlyOpenTabsCollapsed(mNativeNewTabPagePrefs);
}
/**
* Sets whether the list of snapshot documents is collapsed (vs expanded) on the Recent Tabs
* page.
* @param isCollapsed Whether we want the snapshot documents list to be collapsed.
*/ */
public void setSnapshotDocumentCollapsed(boolean isCollapsed) { public void setSnapshotDocumentCollapsed(boolean isCollapsed) {
nativeSetSnapshotDocumentCollapsed(mNativeNewTabPagePrefs, isCollapsed); nativeSetSnapshotDocumentCollapsed(mNativeNewTabPagePrefs, isCollapsed);
} }
/** /**
* Get the snapshot document list collapsed or uncollapsed state in preferences. * Gets whether the list of snapshot documents is collapsed (vs expanded) on
* @return {@code True} Whether the snapshot documnets list is collapsed. * the Recent Tabs page.
* @return Whether the list of snapshot documents is collapsed (vs expanded) on
* the Recent Tabs page.
*/ */
public boolean getSnapshotDocumentCollapsed() { public boolean getSnapshotDocumentCollapsed() {
return nativeGetSnapshotDocumentCollapsed(mNativeNewTabPagePrefs); return nativeGetSnapshotDocumentCollapsed(mNativeNewTabPagePrefs);
} }
/** /**
* Set recently closed tabs list collapsed or uncollapsed state in preferences. * Sets whether the list of recently closed tabs is collapsed (vs expanded) on the Recent Tabs
* @param isCollapsed {@code True} Whether we want the recently closed tabs list to be * page.
* collapsed. * @param isCollapsed Whether we want the recently closed tabs list to be collapsed.
*/ */
public void setRecentlyClosedTabsCollapsed(boolean isCollapsed) { public void setRecentlyClosedTabsCollapsed(boolean isCollapsed) {
nativeSetRecentlyClosedTabsCollapsed(mNativeNewTabPagePrefs, isCollapsed); nativeSetRecentlyClosedTabsCollapsed(mNativeNewTabPagePrefs, isCollapsed);
} }
/** /**
* Get the recently closed document list collapsed or uncollapsed state in preferences. * Gets whether the list of recently closed tabs is collapsed (vs expanded) on
* @return {@code True} Whether the recently closed list is collapsed. * the Recent Tabs page.
* @return Whether the list of recently closed tabs is collapsed (vs expanded) on
* the Recent Tabs page.
*/ */
public boolean getRecentlyClosedTabsCollapsed() { public boolean getRecentlyClosedTabsCollapsed() {
return nativeGetRecentlyClosedTabsCollapsed(mNativeNewTabPagePrefs); return nativeGetRecentlyClosedTabsCollapsed(mNativeNewTabPagePrefs);
} }
/** /**
* Set sync promo collapsed or uncollapsed state in preferences. * Sets whether sync promo is collapsed (vs expanded) on the Recent Tabs page.
* @param isCollapsed {@code True} Whether we want the sync promo to be collapsed. * @param isCollapsed Whether we want the sync promo to be collapsed.
*/ */
public void setSyncPromoCollapsed(boolean isCollapsed) { public void setSyncPromoCollapsed(boolean isCollapsed) {
nativeSetSyncPromoCollapsed(mNativeNewTabPagePrefs, isCollapsed); nativeSetSyncPromoCollapsed(mNativeNewTabPagePrefs, isCollapsed);
} }
/** /**
* Get the sync promo collapsed or uncollapsed state in preferences. * Gets whether sync promo is collapsed (vs expanded) on the Recent Tabs page.
* @return {@code True} Whether the snapshot documnets list is collapsed. * @return Whether the sync promo is collapsed (vs expanded) on the Recent Tabs page.
*/ */
public boolean getSyncPromoCollapsed() { public boolean getSyncPromoCollapsed() {
return nativeGetSyncPromoCollapsed(mNativeNewTabPagePrefs); return nativeGetSyncPromoCollapsed(mNativeNewTabPagePrefs);
} }
/** /**
* Set the given session collapsed or uncollapsed in preferences. * Sets whether the given foreign session is collapsed (vs expanded) on the Recent Tabs page.
* @param session Session to set collapsed or uncollapsed. * @param session Session to set collapsed or expanded.
* @param isCollapsed {@code True} iff we want the session to be collapsed. * @param isCollapsed Whether we want the foreign session to be collapsed.
*/ */
public void setForeignSessionCollapsed(ForeignSession session, boolean isCollapsed) { public void setForeignSessionCollapsed(ForeignSession session, boolean isCollapsed) {
nativeSetForeignSessionCollapsed(mNativeNewTabPagePrefs, session.tag, isCollapsed); nativeSetForeignSessionCollapsed(mNativeNewTabPagePrefs, session.tag, isCollapsed);
} }
/** /**
* Get the given session collapsed or uncollapsed state in preferences. * Gets whether the given foreign session is collapsed (vs expanded) on the Recent Tabs page.
* @param session Session to fetch collapsed state. * @param session Session to fetch collapsed state.
* @return {@code True} if the session is collapsed, false if expanded. * @return Whether the given foreign session is collapsed (vs expanded) on the Recent Tabs page.
*/ */
public boolean getForeignSessionCollapsed(ForeignSession session) { public boolean getForeignSessionCollapsed(ForeignSession session) {
return nativeGetForeignSessionCollapsed(mNativeNewTabPagePrefs, session.tag); return nativeGetForeignSessionCollapsed(mNativeNewTabPagePrefs, session.tag);
...@@ -99,6 +122,10 @@ public class NewTabPagePrefs { ...@@ -99,6 +122,10 @@ public class NewTabPagePrefs {
private static native long nativeInit(Profile profile); private static native long nativeInit(Profile profile);
private static native void nativeDestroy(long nativeNewTabPagePrefs); private static native void nativeDestroy(long nativeNewTabPagePrefs);
private static native void nativeSetCurrentlyOpenTabsCollapsed(
long nativeNewTabPagePrefs, boolean isCollapsed);
private static native boolean nativeGetCurrentlyOpenTabsCollapsed(
long nativeNewTabPagePrefs);
private static native void nativeSetSnapshotDocumentCollapsed( private static native void nativeSetSnapshotDocumentCollapsed(
long nativeNewTabPagePrefs, boolean isCollapsed); long nativeNewTabPagePrefs, boolean isCollapsed);
private static native boolean nativeGetSnapshotDocumentCollapsed( private static native boolean nativeGetSnapshotDocumentCollapsed(
......
...@@ -33,6 +33,19 @@ void NewTabPagePrefs::Destroy(JNIEnv* env, jobject obj) { ...@@ -33,6 +33,19 @@ void NewTabPagePrefs::Destroy(JNIEnv* env, jobject obj) {
NewTabPagePrefs::~NewTabPagePrefs() { NewTabPagePrefs::~NewTabPagePrefs() {
} }
jboolean NewTabPagePrefs::GetCurrentlyOpenTabsCollapsed(JNIEnv* env,
jobject obj) {
PrefService* prefs = profile_->GetPrefs();
return prefs->GetBoolean(prefs::kNtpCollapsedCurrentlyOpenTabs);
}
void NewTabPagePrefs::SetCurrentlyOpenTabsCollapsed(JNIEnv* env,
jobject obj,
jboolean is_collapsed) {
PrefService* prefs = profile_->GetPrefs();
prefs->SetBoolean(prefs::kNtpCollapsedCurrentlyOpenTabs, is_collapsed);
}
jboolean NewTabPagePrefs::GetSnapshotDocumentCollapsed(JNIEnv* env, jboolean NewTabPagePrefs::GetSnapshotDocumentCollapsed(JNIEnv* env,
jobject obj) { jobject obj) {
return profile_->GetPrefs()->GetBoolean(prefs::kNtpCollapsedSnapshotDocument); return profile_->GetPrefs()->GetBoolean(prefs::kNtpCollapsedSnapshotDocument);
......
...@@ -14,6 +14,11 @@ class NewTabPagePrefs { ...@@ -14,6 +14,11 @@ class NewTabPagePrefs {
explicit NewTabPagePrefs(Profile* profile); explicit NewTabPagePrefs(Profile* profile);
void Destroy(JNIEnv* env, jobject obj); void Destroy(JNIEnv* env, jobject obj);
jboolean GetCurrentlyOpenTabsCollapsed(JNIEnv* env, jobject obj);
void SetCurrentlyOpenTabsCollapsed(JNIEnv* env,
jobject obj,
jboolean is_collapsed);
jboolean GetSnapshotDocumentCollapsed(JNIEnv* env, jobject obj); jboolean GetSnapshotDocumentCollapsed(JNIEnv* env, jobject obj);
void SetSnapshotDocumentCollapsed(JNIEnv* env, void SetSnapshotDocumentCollapsed(JNIEnv* env,
jobject obj, jobject obj,
......
...@@ -1522,6 +1522,9 @@ const char kDisablePluginFinder[] = "plugins.disable_plugin_finder"; ...@@ -1522,6 +1522,9 @@ const char kDisablePluginFinder[] = "plugins.disable_plugin_finder";
// Customized app page names that appear on the New Tab Page. // Customized app page names that appear on the New Tab Page.
const char kNtpAppPageNames[] = "ntp.app_page_names"; const char kNtpAppPageNames[] = "ntp.app_page_names";
// Keeps track of currently open tabs collapsed state in the Other Devices menu.
const char kNtpCollapsedCurrentlyOpenTabs[] = "ntp.collapsed_open_tabs";
// Keeps track of which sessions are collapsed in the Other Devices menu. // Keeps track of which sessions are collapsed in the Other Devices menu.
const char kNtpCollapsedForeignSessions[] = "ntp.collapsed_foreign_sessions"; const char kNtpCollapsedForeignSessions[] = "ntp.collapsed_foreign_sessions";
......
...@@ -517,6 +517,7 @@ extern const char kDisableExtensions[]; ...@@ -517,6 +517,7 @@ extern const char kDisableExtensions[];
extern const char kDisablePluginFinder[]; extern const char kDisablePluginFinder[];
extern const char kNtpAppPageNames[]; extern const char kNtpAppPageNames[];
extern const char kNtpCollapsedCurrentlyOpenTabs[];
extern const char kNtpCollapsedForeignSessions[]; extern const char kNtpCollapsedForeignSessions[];
extern const char kNtpCollapsedRecentlyClosedTabs[]; extern const char kNtpCollapsedRecentlyClosedTabs[];
extern const char kNtpCollapsedSnapshotDocument[]; extern const char kNtpCollapsedSnapshotDocument[];
......
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