OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_VIEWS_BOOKMARK_MANAGER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_BOOKMARK_MANAGER_VIEW_H_ |
6 #define CHROME_BROWSER_VIEWS_BOOKMARK_MANAGER_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_BOOKMARK_MANAGER_VIEW_H_ |
7 | 7 |
| 8 #include "base/ref_counted.h" |
8 #include "base/task.h" | 9 #include "base/task.h" |
9 #include "chrome/browser/bookmarks/bookmark_context_menu.h" | 10 #include "chrome/browser/bookmarks/bookmark_context_menu.h" |
10 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 12 #include "chrome/browser/shell_dialogs.h" |
11 #include "chrome/views/table_view.h" | 13 #include "chrome/views/table_view.h" |
12 #include "chrome/views/text_field.h" | 14 #include "chrome/views/text_field.h" |
13 #include "chrome/views/tree_view.h" | 15 #include "chrome/views/tree_view.h" |
14 #include "chrome/views/view.h" | 16 #include "chrome/views/view.h" |
15 #include "chrome/views/view_menu_delegate.h" | 17 #include "chrome/views/view_menu_delegate.h" |
16 #include "chrome/views/window_delegate.h" | 18 #include "chrome/views/window_delegate.h" |
17 #include "webkit/glue/window_open_disposition.h" | 19 #include "webkit/glue/window_open_disposition.h" |
18 | 20 |
19 class BookmarkFolderTreeModel; | 21 class BookmarkFolderTreeModel; |
20 class BookmarkFolderTreeView; | 22 class BookmarkFolderTreeView; |
(...skipping 11 matching lines...) Expand all Loading... |
32 // tree is a BookmarkFolderTreeView and the table a BookmarkTableView. A | 34 // tree is a BookmarkFolderTreeView and the table a BookmarkTableView. A |
33 // text field is also provided that allows the user to search the contents | 35 // text field is also provided that allows the user to search the contents |
34 // of the bookmarks. | 36 // of the bookmarks. |
35 class BookmarkManagerView : public views::View, | 37 class BookmarkManagerView : public views::View, |
36 public views::WindowDelegate, | 38 public views::WindowDelegate, |
37 public views::TreeViewController, | 39 public views::TreeViewController, |
38 public views::TableViewObserver, | 40 public views::TableViewObserver, |
39 public views::TextField::Controller, | 41 public views::TextField::Controller, |
40 public BookmarkModelObserver, | 42 public BookmarkModelObserver, |
41 public views::ContextMenuController, | 43 public views::ContextMenuController, |
42 public views::ViewMenuDelegate { | 44 public views::ViewMenuDelegate, |
| 45 public views::MenuDelegate, |
| 46 public SelectFileDialog::Listener { |
43 public: | 47 public: |
44 explicit BookmarkManagerView(Profile* profile); | 48 explicit BookmarkManagerView(Profile* profile); |
45 virtual ~BookmarkManagerView(); | 49 virtual ~BookmarkManagerView(); |
46 | 50 |
47 static void RegisterPrefs(PrefService* prefs); | 51 static void RegisterPrefs(PrefService* prefs); |
48 | 52 |
49 // Shows the bookmark manager. Only one bookmark manager exists. | 53 // Shows the bookmark manager. Only one bookmark manager exists. |
50 static void Show(Profile* profile); | 54 static void Show(Profile* profile); |
51 | 55 |
52 // Returns the current manager, or NULL if the manager is not showing. | 56 // Returns the current manager, or NULL if the manager is not showing. |
53 static BookmarkManagerView* current(); | 57 static BookmarkManagerView* current(); |
54 | 58 |
55 // Selects the specified node in the tree. If node is a URL it's parent is | 59 // Selects the specified node in the tree. If node is a URL it's parent is |
56 // selected and node is selected in the table. | 60 // selected and node is selected in the table. |
57 void SelectInTree(BookmarkNode* node); | 61 void SelectInTree(BookmarkNode* node); |
58 | 62 |
| 63 // Expands all the children of the selected folder. |
| 64 void ExpandAll(BookmarkNode* node); |
| 65 |
59 // Returns the selected folder, which may be null. | 66 // Returns the selected folder, which may be null. |
60 BookmarkNode* GetSelectedFolder(); | 67 BookmarkNode* GetSelectedFolder(); |
61 | 68 |
62 // Returns the selection of the table. | 69 // Returns the selection of the table. |
63 std::vector<BookmarkNode*> GetSelectedTableNodes(); | 70 std::vector<BookmarkNode*> GetSelectedTableNodes(); |
64 | 71 |
65 virtual void PaintBackground(ChromeCanvas* canvas); | 72 virtual void PaintBackground(ChromeCanvas* canvas); |
66 | 73 |
67 virtual gfx::Size GetPreferredSize(); | 74 virtual gfx::Size GetPreferredSize(); |
68 | 75 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 137 |
131 // ContextMenuController. | 138 // ContextMenuController. |
132 virtual void ShowContextMenu(views::View* source, | 139 virtual void ShowContextMenu(views::View* source, |
133 int x, | 140 int x, |
134 int y, | 141 int y, |
135 bool is_mouse_gesture); | 142 bool is_mouse_gesture); |
136 | 143 |
137 // ViewMenuDelegate. | 144 // ViewMenuDelegate. |
138 virtual void RunMenu(views::View* source, const CPoint& pt, HWND hwnd); | 145 virtual void RunMenu(views::View* source, const CPoint& pt, HWND hwnd); |
139 | 146 |
| 147 // MenuDelegate. |
| 148 virtual void ExecuteCommand(int id); |
| 149 |
| 150 // SelectFileDialog::Listener. |
| 151 virtual void FileSelected(const std::wstring& path, void* params); |
| 152 virtual void FileSelectionCanceled(void* params); |
| 153 |
140 // Creates the table model to use when searching. This returns NULL if there | 154 // Creates the table model to use when searching. This returns NULL if there |
141 // is no search text. | 155 // is no search text. |
142 BookmarkTableModel* CreateSearchTableModel(); | 156 BookmarkTableModel* CreateSearchTableModel(); |
143 | 157 |
144 // Sets the model of the table and its parent node. | 158 // Sets the model of the table and its parent node. |
145 void SetTableModel(BookmarkTableModel* new_table_model, | 159 void SetTableModel(BookmarkTableModel* new_table_model, |
146 BookmarkNode* parent_node); | 160 BookmarkNode* parent_node); |
147 | 161 |
148 // Sets the table's model to the results of CreateSearchTableModel and selects | 162 // Sets the table's model to the results of CreateSearchTableModel and selects |
149 // the search node in the tree. | 163 // the search node in the tree. |
(...skipping 10 matching lines...) Expand all Loading... |
160 // Returns the BookmarkModel. | 174 // Returns the BookmarkModel. |
161 BookmarkModel* GetBookmarkModel() const; | 175 BookmarkModel* GetBookmarkModel() const; |
162 | 176 |
163 // Shows the menu. This is invoked to show the context menu for table/tree | 177 // Shows the menu. This is invoked to show the context menu for table/tree |
164 // as well as to show the menu from the organize button. | 178 // as well as to show the menu from the organize button. |
165 void ShowMenu(HWND host, | 179 void ShowMenu(HWND host, |
166 int x, | 180 int x, |
167 int y, | 181 int y, |
168 BookmarkContextMenu::ConfigurationType config); | 182 BookmarkContextMenu::ConfigurationType config); |
169 | 183 |
| 184 // Shows the tools menu. |
| 185 void ShowToolsMenu(HWND host, int x, int y); |
| 186 |
| 187 // Shows the import/export file chooser. These invoke |
| 188 // FileSelected/FileSelectionCanceled when done. |
| 189 void ShowImportBookmarksFileChooser(); |
| 190 void ShowExportBookmarksFileChooser(); |
| 191 |
170 Profile* profile_; | 192 Profile* profile_; |
171 BookmarkTableView* table_view_; | 193 BookmarkTableView* table_view_; |
172 BookmarkFolderTreeView* tree_view_; | 194 BookmarkFolderTreeView* tree_view_; |
173 scoped_ptr<BookmarkTableModel> table_model_; | 195 scoped_ptr<BookmarkTableModel> table_model_; |
174 scoped_ptr<BookmarkFolderTreeModel> tree_model_; | 196 scoped_ptr<BookmarkFolderTreeModel> tree_model_; |
175 views::TextField* search_tf_; | 197 views::TextField* search_tf_; |
176 views::SingleSplitView* split_view_; | 198 views::SingleSplitView* split_view_; |
177 | 199 |
| 200 // Import/export file dialog. |
| 201 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 202 |
178 // Factory used for delaying search. | 203 // Factory used for delaying search. |
179 ScopedRunnableMethodFactory<BookmarkManagerView> search_factory_; | 204 ScopedRunnableMethodFactory<BookmarkManagerView> search_factory_; |
180 | 205 |
181 DISALLOW_COPY_AND_ASSIGN(BookmarkManagerView); | 206 DISALLOW_COPY_AND_ASSIGN(BookmarkManagerView); |
182 }; | 207 }; |
183 | 208 |
184 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_MANAGER_VIEW_H_ | 209 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_MANAGER_VIEW_H_ |
OLD | NEW |