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/keyboard_codes.h" | 8 #include "base/keyboard_codes.h" |
9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // text field is also provided that allows the user to search the contents | 37 // text field is also provided that allows the user to search the contents |
38 // of the bookmarks. | 38 // of the bookmarks. |
39 class BookmarkManagerView : public views::View, | 39 class BookmarkManagerView : public views::View, |
40 public views::ContextMenuController, | 40 public views::ContextMenuController, |
41 public views::MenuDelegate, | 41 public views::MenuDelegate, |
42 public views::TableViewObserver, | 42 public views::TableViewObserver, |
43 public views::Textfield::Controller, | 43 public views::Textfield::Controller, |
44 public views::TreeViewController, | 44 public views::TreeViewController, |
45 public views::ViewMenuDelegate, | 45 public views::ViewMenuDelegate, |
46 public views::WindowDelegate, | 46 public views::WindowDelegate, |
47 #if defined(BROWSER_SYNC) | |
48 public views::ButtonListener, | 47 public views::ButtonListener, |
49 public ProfileSyncServiceObserver, | 48 public ProfileSyncServiceObserver, |
50 #endif | |
51 public BookmarkModelObserver, | 49 public BookmarkModelObserver, |
52 public SelectFileDialog::Listener { | 50 public SelectFileDialog::Listener { |
53 public: | 51 public: |
54 enum CutCopyPasteType { | 52 enum CutCopyPasteType { |
55 CUT, | 53 CUT, |
56 COPY, | 54 COPY, |
57 PASTE, | 55 PASTE, |
58 NONE | 56 NONE |
59 }; | 57 }; |
60 | 58 |
(...skipping 27 matching lines...) Expand all Loading... |
88 virtual bool CanResize() const { return true; } | 86 virtual bool CanResize() const { return true; } |
89 virtual bool CanMaximize() const { return true; } | 87 virtual bool CanMaximize() const { return true; } |
90 virtual std::wstring GetWindowTitle() const; | 88 virtual std::wstring GetWindowTitle() const; |
91 virtual std::wstring GetWindowName() const; | 89 virtual std::wstring GetWindowName() const; |
92 virtual View* GetContentsView() { return this; } | 90 virtual View* GetContentsView() { return this; } |
93 // TODO(sky): implement these when we have an icon. | 91 // TODO(sky): implement these when we have an icon. |
94 //virtual SkBitmap GetWindowIcon(); | 92 //virtual SkBitmap GetWindowIcon(); |
95 //virtual bool ShouldShowWindowIcon() const { return true; } | 93 //virtual bool ShouldShowWindowIcon() const { return true; } |
96 virtual void WindowClosing(); | 94 virtual void WindowClosing(); |
97 | 95 |
98 #if defined(BROWSER_SYNC) | |
99 // ProfileSyncServiceObserver method. | 96 // ProfileSyncServiceObserver method. |
100 virtual void OnStateChanged(); | 97 virtual void OnStateChanged(); |
101 #endif | |
102 | 98 |
103 Profile* profile() const { return profile_; } | 99 Profile* profile() const { return profile_; } |
104 | 100 |
105 protected: | 101 protected: |
106 // View methods. | 102 // View methods. |
107 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); | 103 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); |
108 | 104 |
109 private: | 105 private: |
110 // TableViewObserver methods. | 106 // TableViewObserver methods. |
111 virtual void OnSelectionChanged() {} | 107 virtual void OnSelectionChanged() {} |
112 // Overriden to open the selected table nodes in the current browser. | 108 // Overriden to open the selected table nodes in the current browser. |
113 virtual void OnDoubleClick(); | 109 virtual void OnDoubleClick(); |
114 virtual void OnMiddleClick(); | 110 virtual void OnMiddleClick(); |
115 virtual void OnTableViewDelete(views::TableView* table); | 111 virtual void OnTableViewDelete(views::TableView* table); |
116 virtual void OnKeyDown(base::KeyboardCode keycode); | 112 virtual void OnKeyDown(base::KeyboardCode keycode); |
117 | 113 |
118 // TreeViewController methods. | 114 // TreeViewController methods. |
119 virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view); | 115 virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view); |
120 virtual void OnTreeViewKeyDown(base::KeyboardCode keycode); | 116 virtual void OnTreeViewKeyDown(base::KeyboardCode keycode); |
121 | 117 |
122 #if defined(BROWSER_SYNC) | |
123 // views::ButtonListener method. | 118 // views::ButtonListener method. |
124 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | 119 virtual void ButtonPressed(views::Button* sender, const views::Event& event); |
125 #endif | |
126 | 120 |
127 // BookmarkModelObserver. We're only installed as an observer until the | 121 // BookmarkModelObserver. We're only installed as an observer until the |
128 // bookmarks are loaded. | 122 // bookmarks are loaded. |
129 virtual void Loaded(BookmarkModel* model); | 123 virtual void Loaded(BookmarkModel* model); |
130 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) {} | 124 virtual void BookmarkModelBeingDeleted(BookmarkModel* model) {} |
131 virtual void BookmarkNodeMoved(BookmarkModel* model, | 125 virtual void BookmarkNodeMoved(BookmarkModel* model, |
132 const BookmarkNode* old_parent, | 126 const BookmarkNode* old_parent, |
133 int old_index, | 127 int old_index, |
134 const BookmarkNode* new_parent, | 128 const BookmarkNode* new_parent, |
135 int new_index) {} | 129 int new_index) {} |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 void OnCutCopyPaste(CutCopyPasteType type, bool from_table); | 201 void OnCutCopyPaste(CutCopyPasteType type, bool from_table); |
208 | 202 |
209 // Shows the tools menu. | 203 // Shows the tools menu. |
210 void ShowToolsMenu(int x, int y); | 204 void ShowToolsMenu(int x, int y); |
211 | 205 |
212 // Shows the import/export file chooser. These invoke | 206 // Shows the import/export file chooser. These invoke |
213 // FileSelected/FileSelectionCanceled when done. | 207 // FileSelected/FileSelectionCanceled when done. |
214 void ShowImportBookmarksFileChooser(); | 208 void ShowImportBookmarksFileChooser(); |
215 void ShowExportBookmarksFileChooser(); | 209 void ShowExportBookmarksFileChooser(); |
216 | 210 |
217 #if defined(BROWSER_SYNC) | |
218 void UpdateSyncStatus(); | 211 void UpdateSyncStatus(); |
219 void OpenSyncMyBookmarksDialog(); | 212 void OpenSyncMyBookmarksDialog(); |
220 #endif | |
221 | 213 |
222 Profile* profile_; | 214 Profile* profile_; |
223 BookmarkTableView* table_view_; | 215 BookmarkTableView* table_view_; |
224 BookmarkFolderTreeView* tree_view_; | 216 BookmarkFolderTreeView* tree_view_; |
225 scoped_ptr<BookmarkTableModel> table_model_; | 217 scoped_ptr<BookmarkTableModel> table_model_; |
226 scoped_ptr<BookmarkFolderTreeModel> tree_model_; | 218 scoped_ptr<BookmarkFolderTreeModel> tree_model_; |
227 views::Textfield* search_tf_; | 219 views::Textfield* search_tf_; |
228 views::SingleSplitView* split_view_; | 220 views::SingleSplitView* split_view_; |
229 | 221 |
230 // Import/export file dialog. | 222 // Import/export file dialog. |
231 scoped_refptr<SelectFileDialog> select_file_dialog_; | 223 scoped_refptr<SelectFileDialog> select_file_dialog_; |
232 | 224 |
233 #if defined(BROWSER_SYNC) | |
234 // The sync status button that notifies the user about the current status of | 225 // The sync status button that notifies the user about the current status of |
235 // bookmarks synchronization. | 226 // bookmarks synchronization. |
236 views::TextButton* sync_status_button_; | 227 views::TextButton* sync_status_button_; |
237 | 228 |
238 // A pointer to the ProfileSyncService instance if one exists. | 229 // A pointer to the ProfileSyncService instance if one exists. |
239 ProfileSyncService* sync_service_; | 230 ProfileSyncService* sync_service_; |
240 #endif | |
241 | 231 |
242 // Factory used for delaying search. | 232 // Factory used for delaying search. |
243 ScopedRunnableMethodFactory<BookmarkManagerView> search_factory_; | 233 ScopedRunnableMethodFactory<BookmarkManagerView> search_factory_; |
244 | 234 |
245 DISALLOW_COPY_AND_ASSIGN(BookmarkManagerView); | 235 DISALLOW_COPY_AND_ASSIGN(BookmarkManagerView); |
246 }; | 236 }; |
247 | 237 |
248 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_MANAGER_VIEW_H_ | 238 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_MANAGER_VIEW_H_ |
OLD | NEW |