summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryusufo@google.com <yusufo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-23 17:01:09 +0000
committeryusufo@google.com <yusufo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-23 17:01:09 +0000
commitc4edb13d989c126a2415029ce65b27cef4219b4a (patch)
treebe97a9d218bcbbdbc5bdb8a28b3dcd3a8351fe13
parent9c8ad09e9344e9deb0e2026a96709d38634a7ae7 (diff)
downloadchromium_src-c4edb13d989c126a2415029ce65b27cef4219b4a.zip
chromium_src-c4edb13d989c126a2415029ce65b27cef4219b4a.tar.gz
chromium_src-c4edb13d989c126a2415029ce65b27cef4219b4a.tar.bz2
Merge 284309 "Add prefs for collapsed currently open tabs group ..."
> Add prefs for collapsed currently open tabs group in new tab page > > BUG=389697 > > Review URL: https://codereview.chromium.org/405623003 TBR=yusufo@chromium.org Review URL: https://codereview.chromium.org/417473004 git-svn-id: svn://svn.chromium.org/chrome/branches/2062/src@284963 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/NewTabPagePrefs.java63
-rw-r--r--chrome/browser/android/new_tab_page_prefs.cc13
-rw-r--r--chrome/browser/android/new_tab_page_prefs.h5
-rw-r--r--chrome/common/pref_names.cc3
-rw-r--r--chrome/common/pref_names.h1
5 files changed, 67 insertions, 18 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/NewTabPagePrefs.java b/chrome/android/java/src/org/chromium/chrome/browser/NewTabPagePrefs.java
index f2fdf3f..21e80f8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/NewTabPagePrefs.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/NewTabPagePrefs.java
@@ -31,67 +31,90 @@ public class NewTabPagePrefs {
}
/**
- * Set snapshot document list collapsed or uncollapsed state in preferences.
- * @param isCollapsed {@code True} Whether we want the snapshot documents list to be collapsed.
+ * Sets whether the list of currently open tabs is collapsed (vs expanded) on the Recent Tabs
+ * 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) {
nativeSetSnapshotDocumentCollapsed(mNativeNewTabPagePrefs, isCollapsed);
}
/**
- * Get the snapshot document list collapsed or uncollapsed state in preferences.
- * @return {@code True} Whether the snapshot documnets list is collapsed.
+ * Gets whether the list of snapshot documents is collapsed (vs expanded) on
+ * the Recent Tabs page.
+ * @return Whether the list of snapshot documents is collapsed (vs expanded) on
+ * the Recent Tabs page.
*/
public boolean getSnapshotDocumentCollapsed() {
return nativeGetSnapshotDocumentCollapsed(mNativeNewTabPagePrefs);
}
/**
- * Set recently closed tabs list collapsed or uncollapsed state in preferences.
- * @param isCollapsed {@code True} Whether we want the recently closed tabs list to be
- * collapsed.
+ * Sets whether the list of recently closed tabs is collapsed (vs expanded) on the Recent Tabs
+ * page.
+ * @param isCollapsed Whether we want the recently closed tabs list to be collapsed.
*/
public void setRecentlyClosedTabsCollapsed(boolean isCollapsed) {
nativeSetRecentlyClosedTabsCollapsed(mNativeNewTabPagePrefs, isCollapsed);
}
/**
- * Get the recently closed document list collapsed or uncollapsed state in preferences.
- * @return {@code True} Whether the recently closed list is collapsed.
+ * Gets whether the list of recently closed tabs is collapsed (vs expanded) on
+ * the Recent Tabs page.
+ * @return Whether the list of recently closed tabs is collapsed (vs expanded) on
+ * the Recent Tabs page.
*/
public boolean getRecentlyClosedTabsCollapsed() {
return nativeGetRecentlyClosedTabsCollapsed(mNativeNewTabPagePrefs);
}
/**
- * Set sync promo collapsed or uncollapsed state in preferences.
- * @param isCollapsed {@code True} Whether we want the sync promo to be collapsed.
+ * Sets whether sync promo is collapsed (vs expanded) on the Recent Tabs page.
+ * @param isCollapsed Whether we want the sync promo to be collapsed.
*/
public void setSyncPromoCollapsed(boolean isCollapsed) {
nativeSetSyncPromoCollapsed(mNativeNewTabPagePrefs, isCollapsed);
}
/**
- * Get the sync promo collapsed or uncollapsed state in preferences.
- * @return {@code True} Whether the snapshot documnets list is collapsed.
+ * Gets whether sync promo is collapsed (vs expanded) on the Recent Tabs page.
+ * @return Whether the sync promo is collapsed (vs expanded) on the Recent Tabs page.
*/
public boolean getSyncPromoCollapsed() {
return nativeGetSyncPromoCollapsed(mNativeNewTabPagePrefs);
}
/**
- * Set the given session collapsed or uncollapsed in preferences.
- * @param session Session to set collapsed or uncollapsed.
- * @param isCollapsed {@code True} iff we want the session to be collapsed.
+ * Sets whether the given foreign session is collapsed (vs expanded) on the Recent Tabs page.
+ * @param session Session to set collapsed or expanded.
+ * @param isCollapsed Whether we want the foreign session to be collapsed.
*/
public void setForeignSessionCollapsed(ForeignSession session, boolean 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.
- * @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) {
return nativeGetForeignSessionCollapsed(mNativeNewTabPagePrefs, session.tag);
@@ -99,6 +122,10 @@ public class NewTabPagePrefs {
private static native long nativeInit(Profile profile);
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(
long nativeNewTabPagePrefs, boolean isCollapsed);
private static native boolean nativeGetSnapshotDocumentCollapsed(
diff --git a/chrome/browser/android/new_tab_page_prefs.cc b/chrome/browser/android/new_tab_page_prefs.cc
index 0358fb0..509dfb3 100644
--- a/chrome/browser/android/new_tab_page_prefs.cc
+++ b/chrome/browser/android/new_tab_page_prefs.cc
@@ -33,6 +33,19 @@ void NewTabPagePrefs::Destroy(JNIEnv* env, jobject obj) {
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,
jobject obj) {
return profile_->GetPrefs()->GetBoolean(prefs::kNtpCollapsedSnapshotDocument);
diff --git a/chrome/browser/android/new_tab_page_prefs.h b/chrome/browser/android/new_tab_page_prefs.h
index 99b6a09..7d4333d 100644
--- a/chrome/browser/android/new_tab_page_prefs.h
+++ b/chrome/browser/android/new_tab_page_prefs.h
@@ -14,6 +14,11 @@ class NewTabPagePrefs {
explicit NewTabPagePrefs(Profile* profile);
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);
void SetSnapshotDocumentCollapsed(JNIEnv* env,
jobject obj,
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 2885c1b..40d16c6 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -1649,6 +1649,9 @@ const char kDisablePluginFinder[] = "plugins.disable_plugin_finder";
// Customized app page names that appear on the New Tab Page.
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.
const char kNtpCollapsedForeignSessions[] = "ntp.collapsed_foreign_sessions";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 6e0a457..57f8f05 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -545,6 +545,7 @@ extern const char kDisableExtensions[];
extern const char kDisablePluginFinder[];
extern const char kNtpAppPageNames[];
+extern const char kNtpCollapsedCurrentlyOpenTabs[];
extern const char kNtpCollapsedForeignSessions[];
extern const char kNtpCollapsedRecentlyClosedTabs[];
extern const char kNtpCollapsedSnapshotDocument[];