summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bookmarks/bookmark_utils.cc
diff options
context:
space:
mode:
authorjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-18 00:57:49 +0000
committerjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-18 00:57:49 +0000
commit44b2c885548d647611d908309dfdf6306eac7ed8 (patch)
treec46fd5199ac07df770ca9b01a0b73dc594b6d63d /chrome/browser/bookmarks/bookmark_utils.cc
parent9eef357377e89bffd2d5ff9fad9de0c94d8cc934 (diff)
downloadchromium_src-44b2c885548d647611d908309dfdf6306eac7ed8.zip
chromium_src-44b2c885548d647611d908309dfdf6306eac7ed8.tar.gz
chromium_src-44b2c885548d647611d908309dfdf6306eac7ed8.tar.bz2
Mac bookmark work.
- The bookmark menu is populated dynamically with bookmarks, including subfolders --> submenus. E.g. star something --> shows up in menu. Menu items are disabled but always present and current. - Always Show Bookmarks" menu now live; reads from / writes to preference, and shows correct "toggle state". - Bookmark bar on each tab, present if requested. (Currently an empty box). - Random stuff; e.g. bookmark prefs init moved to a x-plat location. This CL does not contain Cole's views. Bried english description of the nib file changes: - add a new view for the bookmark bar in the tab; hook it up to the controller - Many tag sets (e.g. View-->Always Show Bookmarks Bar now 40009) - Remove dummy bookmark menu items Review URL: http://codereview.chromium.org/46078 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11936 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks/bookmark_utils.cc')
-rw-r--r--chrome/browser/bookmarks/bookmark_utils.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc
index 429c06d..c210dad 100644
--- a/chrome/browser/bookmarks/bookmark_utils.cc
+++ b/chrome/browser/bookmarks/bookmark_utils.cc
@@ -16,6 +16,9 @@
#include "chrome/browser/tab_contents/page_navigator.h"
#include "chrome/common/drag_drop_types.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/notification_service.h"
+#include "chrome/common/pref_names.h"
+#include "chrome/common/pref_service.h"
#include "chrome/views/controls/tree/tree_node_iterator.h"
#include "chrome/views/event.h"
#include "grit/chromium_strings.h"
@@ -529,4 +532,33 @@ bool DoesBookmarkContainText(BookmarkNode* node, const std::wstring& text) {
return (node->is_url() && DoesBookmarkContainWords(node, words));
}
+// Formerly in BookmarkBarView
+void ToggleWhenVisible(Profile* profile) {
+ PrefService* prefs = profile->GetPrefs();
+ const bool always_show = !prefs->GetBoolean(prefs::kShowBookmarkBar);
+
+ // The user changed when the bookmark bar is shown, update the preferences.
+ prefs->SetBoolean(prefs::kShowBookmarkBar, always_show);
+ prefs->ScheduleSavePersistentPrefs(g_browser_process->file_thread());
+
+ // And notify the notification service.
+ Source<Profile> source(profile);
+ NotificationService::current()->Notify(
+ NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
+ source,
+ NotificationService::NoDetails());
+}
+
+void RegisterUserPrefs(PrefService* prefs) {
+ // Formerly in BookmarkBarView
+ prefs->RegisterBooleanPref(prefs::kShowBookmarkBar, false);
+
+ // Formerly in BookmarkTableView
+ prefs->RegisterIntegerPref(prefs::kBookmarkTableNameWidth1, -1);
+ prefs->RegisterIntegerPref(prefs::kBookmarkTableURLWidth1, -1);
+ prefs->RegisterIntegerPref(prefs::kBookmarkTableNameWidth2, -1);
+ prefs->RegisterIntegerPref(prefs::kBookmarkTableURLWidth2, -1);
+ prefs->RegisterIntegerPref(prefs::kBookmarkTablePathWidth, -1);
+}
+
} // namespace bookmark_utils