From 3ec1a3af311b95b325a3302679be1eb68e89e58e Mon Sep 17 00:00:00 2001
From: "sky@google.com" <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Mon, 3 Nov 2008 23:14:01 +0000
Subject: Miscellaneous bookmark manager polish:

. Adds a menu button on the bookmark manager. If I finish up import
  I'll add a second one for importing.
. Creating new page/folder from menu items selects new item in table.
. I changed around the FolderBookmarkTableModel to copy the contents
  into a vector (now extends VectorBackedTabledModel). This is
  necessitated by TableView not providing a moved notification. The
  problem with previous approach is that I sent out ModelChanged on
  any change, which loses selection and causes things to snap around.
  I considered adding a moved method to TableView, but it's too much
  work at this time.
. Added persisting of divider location in bookmark manager.
. When focus is on table pressing enter on a folder descends into the
  folder, and pressing backspace goes back up a folder.

BUG=674
TEST=none

Review URL: http://codereview.chromium.org/8967

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4512 0039d316-1c4b-4281-b951-d872f2087c98
---
 chrome/browser/views/bookmark_manager_view.h | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

(limited to 'chrome/browser/views/bookmark_manager_view.h')

diff --git a/chrome/browser/views/bookmark_manager_view.h b/chrome/browser/views/bookmark_manager_view.h
index c397b33..8a28eac 100644
--- a/chrome/browser/views/bookmark_manager_view.h
+++ b/chrome/browser/views/bookmark_manager_view.h
@@ -6,11 +6,13 @@
 #define CHROME_BROWSER_VIEWS_BOOKMARK_MANAGER_VIEW_H_
 
 #include "base/task.h"
+#include "chrome/browser/bookmarks/bookmark_context_menu.h"
 #include "chrome/browser/bookmarks/bookmark_model.h"
 #include "chrome/views/table_view.h"
 #include "chrome/views/text_field.h"
 #include "chrome/views/tree_view.h"
 #include "chrome/views/view.h"
+#include "chrome/views/view_menu_delegate.h"
 #include "chrome/views/window_delegate.h"
 #include "webkit/glue/window_open_disposition.h"
 
@@ -21,6 +23,9 @@ class BookmarkTableView;
 class PrefService;
 class Profile;
 
+namespace views {
+class SingleSplitView;
+}
 // A view that lets the user manage their bookmarks. The bookmark manager
 // shows a tree on the left with a table on the right. The tree shows the
 // folder nodes and the table the contents of the selected tree node. The
@@ -33,7 +38,8 @@ class BookmarkManagerView : public views::View,
                             public views::TableViewObserver,
                             public views::TextField::Controller,
                             public BookmarkModelObserver,
-                            public views::ContextMenuController {
+                            public views::ContextMenuController,
+                            public views::ViewMenuDelegate {
  public:
   explicit BookmarkManagerView(Profile* profile);
   virtual ~BookmarkManagerView();
@@ -50,6 +56,9 @@ class BookmarkManagerView : public views::View,
   // selected and node is selected in the table.
   void SelectInTree(BookmarkNode* node);
 
+  // Returns the selected folder, which may be null.
+  BookmarkNode* GetSelectedFolder();
+
   // Returns the selection of the table.
   std::vector<BookmarkNode*> GetSelectedTableNodes();
 
@@ -57,7 +66,7 @@ class BookmarkManagerView : public views::View,
 
   virtual gfx::Size GetPreferredSize();
 
-  // WindowDelegate.
+  // WindowDelegate methods.
   virtual bool CanResize() const { return true; }
   virtual bool CanMaximize() const { return true; }
   virtual std::wstring GetWindowTitle() const;
@@ -71,6 +80,9 @@ class BookmarkManagerView : public views::View,
   // TODO(sky): implement these when we have an icon.
   //virtual SkBitmap GetWindowIcon();
   //virtual bool ShouldShowWindowIcon() const { return true; }
+  virtual void WindowClosing();
+
+  Profile* profile() const { return profile_; }
 
  private:
   // TableViewObserver methods.
@@ -78,6 +90,7 @@ class BookmarkManagerView : public views::View,
   // Overriden to open the selected table nodes in the current browser.
   virtual void OnDoubleClick();
   virtual void OnTableViewDelete(views::TableView* table);
+  virtual void OnKeyDown(unsigned short virtual_keycode);
 
   // TreeViewController method.
   virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view);
@@ -121,6 +134,9 @@ class BookmarkManagerView : public views::View,
                                int y,
                                bool is_mouse_gesture);
 
+  // ViewMenuDelegate.
+  virtual void RunMenu(views::View* source, const CPoint& pt, HWND hwnd);
+
   // Creates the table model to use when searching. This returns NULL if there
   // is no search text.
   BookmarkTableModel* CreateSearchTableModel();
@@ -144,12 +160,20 @@ class BookmarkManagerView : public views::View,
   // Returns the BookmarkModel.
   BookmarkModel* GetBookmarkModel() const;
 
+  // Shows the menu. This is invoked to show the context menu for table/tree
+  // as well as to show the menu from the organize button.
+  void ShowMenu(HWND host,
+                int x,
+                int y,
+                BookmarkContextMenu::ConfigurationType config);
+
   Profile* profile_;
   BookmarkTableView* table_view_;
   BookmarkFolderTreeView* tree_view_;
   scoped_ptr<BookmarkTableModel> table_model_;
   scoped_ptr<BookmarkFolderTreeModel> tree_model_;
   views::TextField* search_tf_;
+  views::SingleSplitView* split_view_;
 
   // Factory used for delaying search.
   ScopedRunnableMethodFactory<BookmarkManagerView> search_factory_;
-- 
cgit v1.1