OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/ref_counted.h" |
9 #include "base/task.h" | 9 #include "base/task.h" |
10 #include "chrome/browser/bookmarks/bookmark_context_menu.h" | 10 #include "chrome/browser/bookmarks/bookmark_context_menu.h" |
11 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
12 #include "chrome/browser/shell_dialogs.h" | 12 #include "chrome/browser/shell_dialogs.h" |
13 #include "views/controls/menu/view_menu_delegate.h" | 13 #include "views/controls/menu/view_menu_delegate.h" |
14 #include "views/controls/table/table_view.h" | 14 #include "views/controls/table/table_view.h" |
15 #include "views/controls/text_field.h" | 15 #include "views/controls/textfield/textfield.h" |
16 #include "views/controls/tree/tree_view.h" | 16 #include "views/controls/tree/tree_view.h" |
17 #include "views/view.h" | 17 #include "views/view.h" |
18 #include "views/window/window_delegate.h" | 18 #include "views/window/window_delegate.h" |
19 #include "webkit/glue/window_open_disposition.h" | 19 #include "webkit/glue/window_open_disposition.h" |
20 | 20 |
21 class BookmarkFolderTreeModel; | 21 class BookmarkFolderTreeModel; |
22 class BookmarkFolderTreeView; | 22 class BookmarkFolderTreeView; |
23 class BookmarkTableModel; | 23 class BookmarkTableModel; |
24 class BookmarkTableView; | 24 class BookmarkTableView; |
25 class PrefService; | 25 class PrefService; |
26 class Profile; | 26 class Profile; |
27 | 27 |
28 namespace views { | 28 namespace views { |
29 class SingleSplitView; | 29 class SingleSplitView; |
30 } | 30 } |
31 // A view that lets the user manage their bookmarks. The bookmark manager | 31 // A view that lets the user manage their bookmarks. The bookmark manager |
32 // shows a tree on the left with a table on the right. The tree shows the | 32 // shows a tree on the left with a table on the right. The tree shows the |
33 // folder nodes and the table the contents of the selected tree node. The | 33 // folder nodes and the table the contents of the selected tree node. The |
34 // tree is a BookmarkFolderTreeView and the table a BookmarkTableView. A | 34 // tree is a BookmarkFolderTreeView and the table a BookmarkTableView. A |
35 // 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 |
36 // of the bookmarks. | 36 // of the bookmarks. |
37 class BookmarkManagerView : public views::View, | 37 class BookmarkManagerView : public views::View, |
38 public views::WindowDelegate, | 38 public views::WindowDelegate, |
39 public views::TreeViewController, | 39 public views::TreeViewController, |
40 public views::TableViewObserver, | 40 public views::TableViewObserver, |
41 public views::TextField::Controller, | 41 public views::Textfield::Controller, |
42 public BookmarkModelObserver, | 42 public BookmarkModelObserver, |
43 public views::ContextMenuController, | 43 public views::ContextMenuController, |
44 public views::ViewMenuDelegate, | 44 public views::ViewMenuDelegate, |
45 public views::MenuDelegate, | 45 public views::MenuDelegate, |
46 public SelectFileDialog::Listener { | 46 public SelectFileDialog::Listener { |
47 public: | 47 public: |
48 enum CutCopyPasteType { | 48 enum CutCopyPasteType { |
49 CUT, | 49 CUT, |
50 COPY, | 50 COPY, |
51 PASTE, | 51 PASTE, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 BookmarkNode* parent, | 129 BookmarkNode* parent, |
130 int old_index, | 130 int old_index, |
131 BookmarkNode* node) {} | 131 BookmarkNode* node) {} |
132 virtual void BookmarkNodeChanged(BookmarkModel* model, | 132 virtual void BookmarkNodeChanged(BookmarkModel* model, |
133 BookmarkNode* node) {} | 133 BookmarkNode* node) {} |
134 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, | 134 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, |
135 BookmarkNode* node) {} | 135 BookmarkNode* node) {} |
136 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, | 136 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, |
137 BookmarkNode* node) {} | 137 BookmarkNode* node) {} |
138 | 138 |
139 // TextField::Controller methods. | 139 // Textfield::Controller methods. |
140 // Starts a timer to search for the search text. | 140 // Starts a timer to search for the search text. |
141 virtual void ContentsChanged(views::TextField* sender, | 141 virtual void ContentsChanged(views::Textfield* sender, |
142 const std::wstring& new_contents); | 142 const std::wstring& new_contents); |
143 // If return has been pressed this performs an immediate search. | 143 // If return has been pressed this performs an immediate search. |
144 virtual bool HandleKeystroke(views::TextField* sender, | 144 virtual bool HandleKeystroke(views::Textfield* sender, |
145 const views::TextField::Keystroke& key); | 145 const views::Textfield::Keystroke& key); |
146 | 146 |
147 // ContextMenuController. | 147 // ContextMenuController. |
148 virtual void ShowContextMenu(views::View* source, | 148 virtual void ShowContextMenu(views::View* source, |
149 int x, | 149 int x, |
150 int y, | 150 int y, |
151 bool is_mouse_gesture); | 151 bool is_mouse_gesture); |
152 | 152 |
153 // ViewMenuDelegate. | 153 // ViewMenuDelegate. |
154 virtual void RunMenu(views::View* source, const gfx::Point& pt, HWND hwnd); | 154 virtual void RunMenu(views::View* source, const gfx::Point& pt, HWND hwnd); |
155 | 155 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // Shows the import/export file chooser. These invoke | 203 // Shows the import/export file chooser. These invoke |
204 // FileSelected/FileSelectionCanceled when done. | 204 // FileSelected/FileSelectionCanceled when done. |
205 void ShowImportBookmarksFileChooser(); | 205 void ShowImportBookmarksFileChooser(); |
206 void ShowExportBookmarksFileChooser(); | 206 void ShowExportBookmarksFileChooser(); |
207 | 207 |
208 Profile* profile_; | 208 Profile* profile_; |
209 BookmarkTableView* table_view_; | 209 BookmarkTableView* table_view_; |
210 BookmarkFolderTreeView* tree_view_; | 210 BookmarkFolderTreeView* tree_view_; |
211 scoped_ptr<BookmarkTableModel> table_model_; | 211 scoped_ptr<BookmarkTableModel> table_model_; |
212 scoped_ptr<BookmarkFolderTreeModel> tree_model_; | 212 scoped_ptr<BookmarkFolderTreeModel> tree_model_; |
213 views::TextField* search_tf_; | 213 views::Textfield* search_tf_; |
214 views::SingleSplitView* split_view_; | 214 views::SingleSplitView* split_view_; |
215 | 215 |
216 // Import/export file dialog. | 216 // Import/export file dialog. |
217 scoped_refptr<SelectFileDialog> select_file_dialog_; | 217 scoped_refptr<SelectFileDialog> select_file_dialog_; |
218 | 218 |
219 // Factory used for delaying search. | 219 // Factory used for delaying search. |
220 ScopedRunnableMethodFactory<BookmarkManagerView> search_factory_; | 220 ScopedRunnableMethodFactory<BookmarkManagerView> search_factory_; |
221 | 221 |
222 DISALLOW_COPY_AND_ASSIGN(BookmarkManagerView); | 222 DISALLOW_COPY_AND_ASSIGN(BookmarkManagerView); |
223 }; | 223 }; |
224 | 224 |
225 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_MANAGER_VIEW_H_ | 225 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_MANAGER_VIEW_H_ |
OLD | NEW |