diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 17:23:36 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 17:23:36 +0000 |
commit | 1e7bab7fc3f214061e216722e7879c7e1580059a (patch) | |
tree | 88f2b82fa0d0c2afd3f85b544b650a73a04c5978 /chrome/browser/bookmarks | |
parent | 0c9ee9904acbfe0766f488edb207ff232635efd3 (diff) | |
download | chromium_src-1e7bab7fc3f214061e216722e7879c7e1580059a.zip chromium_src-1e7bab7fc3f214061e216722e7879c7e1580059a.tar.gz chromium_src-1e7bab7fc3f214061e216722e7879c7e1580059a.tar.bz2 |
Linux bookmark manager first cut.
Also add icons to bookmark tree model.
Review URL: http://codereview.chromium.org/118150
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17489 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/bookmarks')
-rw-r--r-- | chrome/browser/bookmarks/bookmark_context_menu.cc | 29 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_manager.h | 25 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_utils.cc | 7 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_utils.h | 3 |
4 files changed, 46 insertions, 18 deletions
diff --git a/chrome/browser/bookmarks/bookmark_context_menu.cc b/chrome/browser/bookmarks/bookmark_context_menu.cc index 35389f4..3b1247d 100644 --- a/chrome/browser/bookmarks/bookmark_context_menu.cc +++ b/chrome/browser/bookmarks/bookmark_context_menu.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ #include "app/l10n_util.h" #include "base/compiler_specific.h" #include "chrome/browser/bookmarks/bookmark_editor.h" +#include "chrome/browser/bookmarks/bookmark_manager.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" #include "chrome/browser/browser.h" @@ -22,7 +23,6 @@ // TODO(port): Port these files. #if defined(OS_WIN) #include "chrome/browser/tab_contents/tab_contents.h" -#include "chrome/browser/views/bookmark_manager_view.h" #include "views/window/window.h" #endif @@ -106,12 +106,10 @@ class EditFolderController : public InputWindowDialog::Delegate, ALLOW_UNUSED BookmarkNode* node = model_->AddGroup(node_, node_->GetChildCount(), text); if (show_in_manager_) { -#if defined(OS_WIN) - BookmarkManagerView* manager = BookmarkManagerView::current(); - if (manager && manager->profile() == profile_) - manager->SelectInTree(node); +#if defined(OS_WIN) || defined(OS_LINUX) + BookmarkManager::SelectInTree(profile_, node); #else - NOTIMPLEMENTED() << "BookmarkManagerView not yet implemented"; + NOTIMPLEMENTED() << "BookmarkManager not yet implemented"; #endif } } else { @@ -195,11 +193,7 @@ class SelectOnCreationHandler : public BookmarkEditor::Handler { } virtual void NodeCreated(BookmarkNode* new_node) { - BookmarkManagerView* manager = BookmarkManagerView::current(); - if (!manager || manager->profile() != profile_) - return; // Manager no longer showing, or showing a different profile. - - manager->SelectInTree(new_node); + BookmarkManager::SelectInTree(profile_, new_node); } private: @@ -336,7 +330,7 @@ void BookmarkContextMenu::ExecuteCommand(int id) { } if (selection_[0]->is_url()) { -#if defined(OS_WIN) +#if defined(OS_WIN) || defined(OS_LINUX) BookmarkEditor::Configuration editor_config; if (configuration_ == BOOKMARK_BAR) editor_config = BookmarkEditor::SHOW_TREE; @@ -407,9 +401,8 @@ void BookmarkContextMenu::ExecuteCommand(int id) { return; } -#if defined(OS_WIN) - if (BookmarkManagerView::current()) - BookmarkManagerView::current()->SelectInTree(selection_[0]); +#if defined(OS_WIN) || defined(OS_LINUX) + BookmarkManager::SelectInTree(profile_, selection_[0]); #else NOTIMPLEMENTED() << "Bookmark Manager not implemented"; #endif @@ -417,8 +410,8 @@ void BookmarkContextMenu::ExecuteCommand(int id) { case IDS_BOOKMARK_MANAGER: UserMetrics::RecordAction(L"ShowBookmarkManager", profile_); -#if defined(OS_WIN) - BookmarkManagerView::Show(profile_); +#if defined(OS_WIN) || defined(OS_LINUX) + BookmarkManager::Show(profile_); #else NOTIMPLEMENTED() << "Bookmark Manager not implemented"; #endif diff --git a/chrome/browser/bookmarks/bookmark_manager.h b/chrome/browser/bookmarks/bookmark_manager.h new file mode 100644 index 0000000..28a210b --- /dev/null +++ b/chrome/browser/bookmarks/bookmark_manager.h @@ -0,0 +1,25 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_MANAGER_H_ +#define CHROME_BROWSER_BOOKMARKS_BOOKMARK_MANAGER_H_ + +class BookmarkNode; +class PrefService; +class Profile; + +// Cross-platform API for interacting with BookmarkManager views. +// Implemented alongside the platform-specific view classes. +class BookmarkManager { + public: + // Select |node| in the tree view of the bookmark manager, but only if the + // manager is showing and is for |profile|. + static void SelectInTree(Profile* profile, BookmarkNode* node); + + // Show the bookmark manager for |profile|. Only one bookmark manager shows + // at a time, so if another one is showing, this does nothing. + static void Show(Profile* profile); +}; + +#endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_MANAGER_H_ diff --git a/chrome/browser/bookmarks/bookmark_utils.cc b/chrome/browser/bookmarks/bookmark_utils.cc index c3e6dd3..d951df9 100644 --- a/chrome/browser/bookmarks/bookmark_utils.cc +++ b/chrome/browser/bookmarks/bookmark_utils.cc @@ -608,6 +608,13 @@ void ToggleWhenVisible(Profile* profile) { NotificationService::NoDetails()); } +// static +void RegisterPrefs(PrefService* prefs) { + prefs->RegisterDictionaryPref(prefs::kBookmarkManagerPlacement); + prefs->RegisterIntegerPref(prefs::kBookmarkManagerSplitLocation, -1); +} + +// static void RegisterUserPrefs(PrefService* prefs) { // Formerly in BookmarkBarView prefs->RegisterBooleanPref(prefs::kShowBookmarkBar, false); diff --git a/chrome/browser/bookmarks/bookmark_utils.h b/chrome/browser/bookmarks/bookmark_utils.h index e161a81..2a7cbda 100644 --- a/chrome/browser/bookmarks/bookmark_utils.h +++ b/chrome/browser/bookmarks/bookmark_utils.h @@ -163,6 +163,9 @@ void ApplyEditsWithPossibleGroupChange(BookmarkModel* model, // all tabs. This is a preference modifier, not a visual modifier. void ToggleWhenVisible(Profile* profile); +// Register local state prefs for bookmark bar view. +void RegisterPrefs(PrefService* prefs); + // Register user prefs for BookmarkBar, BookmarkView, ... void RegisterUserPrefs(PrefService* prefs); |