OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_VIEWS_BOOKMARKS_BOOKMARK_EDITOR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_EDITOR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_EDITOR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_EDITOR_VIEW_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Type of node in the tree. Public purely for testing. | 56 // Type of node in the tree. Public purely for testing. |
57 typedef ui::TreeNodeWithValue<int64> EditorNode; | 57 typedef ui::TreeNodeWithValue<int64> EditorNode; |
58 | 58 |
59 // Model for the TreeView. Trivial subclass that doesn't allow titles with | 59 // Model for the TreeView. Trivial subclass that doesn't allow titles with |
60 // empty strings. Public purely for testing. | 60 // empty strings. Public purely for testing. |
61 class EditorTreeModel : public ui::TreeNodeModel<EditorNode> { | 61 class EditorTreeModel : public ui::TreeNodeModel<EditorNode> { |
62 public: | 62 public: |
63 explicit EditorTreeModel(EditorNode* root) | 63 explicit EditorTreeModel(EditorNode* root) |
64 : ui::TreeNodeModel<EditorNode>(root) {} | 64 : ui::TreeNodeModel<EditorNode>(root) {} |
65 | 65 |
66 virtual void SetTitle(ui::TreeModelNode* node, | 66 void SetTitle(ui::TreeModelNode* node, |
67 const base::string16& title) override; | 67 const base::string16& title) override; |
68 | 68 |
69 private: | 69 private: |
70 DISALLOW_COPY_AND_ASSIGN(EditorTreeModel); | 70 DISALLOW_COPY_AND_ASSIGN(EditorTreeModel); |
71 }; | 71 }; |
72 | 72 |
73 BookmarkEditorView(Profile* profile, | 73 BookmarkEditorView(Profile* profile, |
74 const BookmarkNode* parent, | 74 const BookmarkNode* parent, |
75 const EditDetails& details, | 75 const EditDetails& details, |
76 BookmarkEditor::Configuration configuration); | 76 BookmarkEditor::Configuration configuration); |
77 | 77 |
78 virtual ~BookmarkEditorView(); | 78 ~BookmarkEditorView() override; |
79 | 79 |
80 // views::DialogDelegateView: | 80 // views::DialogDelegateView: |
81 virtual base::string16 GetDialogButtonLabel( | 81 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
82 ui::DialogButton button) const override; | 82 bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
83 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const override; | 83 views::View* CreateExtraView() override; |
84 virtual views::View* CreateExtraView() override; | 84 ui::ModalType GetModalType() const override; |
85 virtual ui::ModalType GetModalType() const override; | 85 bool CanResize() const override; |
86 virtual bool CanResize() const override; | 86 base::string16 GetWindowTitle() const override; |
87 virtual base::string16 GetWindowTitle() const override; | 87 bool Accept() override; |
88 virtual bool Accept() override; | |
89 | 88 |
90 // views::View: | 89 // views::View: |
91 virtual gfx::Size GetPreferredSize() const override; | 90 gfx::Size GetPreferredSize() const override; |
92 virtual void GetAccessibleState(ui::AXViewState* state) override; | 91 void GetAccessibleState(ui::AXViewState* state) override; |
93 | 92 |
94 // views::TreeViewController: | 93 // views::TreeViewController: |
95 virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view) override; | 94 void OnTreeViewSelectionChanged(views::TreeView* tree_view) override; |
96 virtual bool CanEdit(views::TreeView* tree_view, | 95 bool CanEdit(views::TreeView* tree_view, ui::TreeModelNode* node) override; |
97 ui::TreeModelNode* node) override; | |
98 | 96 |
99 // views::TextfieldController: | 97 // views::TextfieldController: |
100 virtual void ContentsChanged(views::Textfield* sender, | 98 void ContentsChanged(views::Textfield* sender, |
101 const base::string16& new_contents) override; | 99 const base::string16& new_contents) override; |
102 virtual bool HandleKeyEvent(views::Textfield* sender, | 100 bool HandleKeyEvent(views::Textfield* sender, |
103 const ui::KeyEvent& key_event) override; | 101 const ui::KeyEvent& key_event) override; |
104 | 102 |
105 // views::ButtonListener: | 103 // views::ButtonListener: |
106 virtual void ButtonPressed(views::Button* sender, | 104 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
107 const ui::Event& event) override; | |
108 | 105 |
109 // ui::SimpleMenuModel::Delegate: | 106 // ui::SimpleMenuModel::Delegate: |
110 virtual bool IsCommandIdChecked(int command_id) const override; | 107 bool IsCommandIdChecked(int command_id) const override; |
111 virtual bool IsCommandIdEnabled(int command_id) const override; | 108 bool IsCommandIdEnabled(int command_id) const override; |
112 virtual bool GetAcceleratorForCommandId( | 109 bool GetAcceleratorForCommandId(int command_id, |
113 int command_id, | 110 ui::Accelerator* accelerator) override; |
114 ui::Accelerator* accelerator) override; | 111 void ExecuteCommand(int command_id, int event_flags) override; |
115 virtual void ExecuteCommand(int command_id, int event_flags) override; | |
116 | 112 |
117 // Creates a Window and adds the BookmarkEditorView to it. When the window is | 113 // Creates a Window and adds the BookmarkEditorView to it. When the window is |
118 // closed the BookmarkEditorView is deleted. | 114 // closed the BookmarkEditorView is deleted. |
119 void Show(gfx::NativeWindow parent); | 115 void Show(gfx::NativeWindow parent); |
120 | 116 |
121 // views::ContextMenuController: | 117 // views::ContextMenuController: |
122 virtual void ShowContextMenuForView(views::View* source, | 118 void ShowContextMenuForView(views::View* source, |
123 const gfx::Point& point, | 119 const gfx::Point& point, |
124 ui::MenuSourceType source_type) override; | 120 ui::MenuSourceType source_type) override; |
125 | 121 |
126 private: | 122 private: |
127 friend class BookmarkEditorViewTest; | 123 friend class BookmarkEditorViewTest; |
128 | 124 |
129 // Creates the necessary sub-views, configures them, adds them to the layout, | 125 // Creates the necessary sub-views, configures them, adds them to the layout, |
130 // and requests the entries to display from the database. | 126 // and requests the entries to display from the database. |
131 void Init(); | 127 void Init(); |
132 | 128 |
133 // BookmarkModel observer methods. Any structural change results in | 129 // BookmarkModel observer methods. Any structural change results in |
134 // resetting the tree model. | 130 // resetting the tree model. |
135 virtual void BookmarkModelLoaded(BookmarkModel* model, | 131 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override { |
136 bool ids_reassigned) override {} | 132 } |
137 virtual void BookmarkNodeMoved(BookmarkModel* model, | 133 void BookmarkNodeMoved(BookmarkModel* model, |
138 const BookmarkNode* old_parent, | 134 const BookmarkNode* old_parent, |
139 int old_index, | 135 int old_index, |
140 const BookmarkNode* new_parent, | 136 const BookmarkNode* new_parent, |
141 int new_index) override; | 137 int new_index) override; |
142 virtual void BookmarkNodeAdded(BookmarkModel* model, | 138 void BookmarkNodeAdded(BookmarkModel* model, |
143 const BookmarkNode* parent, | 139 const BookmarkNode* parent, |
144 int index) override; | 140 int index) override; |
145 virtual void BookmarkNodeRemoved(BookmarkModel* model, | 141 void BookmarkNodeRemoved(BookmarkModel* model, |
146 const BookmarkNode* parent, | 142 const BookmarkNode* parent, |
147 int index, | 143 int index, |
148 const BookmarkNode* node, | 144 const BookmarkNode* node, |
| 145 const std::set<GURL>& removed_urls) override; |
| 146 void BookmarkAllUserNodesRemoved(BookmarkModel* model, |
149 const std::set<GURL>& removed_urls) override; | 147 const std::set<GURL>& removed_urls) override; |
150 virtual void BookmarkAllUserNodesRemoved( | 148 void BookmarkNodeChanged(BookmarkModel* model, |
151 BookmarkModel* model, | 149 const BookmarkNode* node) override {} |
152 const std::set<GURL>& removed_urls) override; | 150 void BookmarkNodeChildrenReordered(BookmarkModel* model, |
153 virtual void BookmarkNodeChanged(BookmarkModel* model, | 151 const BookmarkNode* node) override; |
154 const BookmarkNode* node) override {} | 152 void BookmarkNodeFaviconChanged(BookmarkModel* model, |
155 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, | 153 const BookmarkNode* node) override {} |
156 const BookmarkNode* node) override; | |
157 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, | |
158 const BookmarkNode* node) override {} | |
159 | 154 |
160 // Resets the model of the tree and updates the various buttons appropriately. | 155 // Resets the model of the tree and updates the various buttons appropriately. |
161 void Reset(); | 156 void Reset(); |
162 | 157 |
163 // Expands all the nodes in the tree and selects the parent node of the | 158 // Expands all the nodes in the tree and selects the parent node of the |
164 // url we're editing or the most recent parent if the url being editted isn't | 159 // url we're editing or the most recent parent if the url being editted isn't |
165 // starred. | 160 // starred. |
166 void ExpandAndSelect(); | 161 void ExpandAndSelect(); |
167 | 162 |
168 // Creates a returns the new root node. This invokes CreateNodes to do | 163 // Creates a returns the new root node. This invokes CreateNodes to do |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 // Is the tree shown? | 262 // Is the tree shown? |
268 bool show_tree_; | 263 bool show_tree_; |
269 | 264 |
270 // List of deleted bookmark folders. | 265 // List of deleted bookmark folders. |
271 std::vector<int64> deletes_; | 266 std::vector<int64> deletes_; |
272 | 267 |
273 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorView); | 268 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorView); |
274 }; | 269 }; |
275 | 270 |
276 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_EDITOR_VIEW_H_ | 271 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_EDITOR_VIEW_H_ |
OLD | NEW |