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 <stdint.h> |
| 9 |
8 #include <vector> | 10 #include <vector> |
9 | 11 |
10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" |
11 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
12 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" | 15 #include "chrome/browser/ui/bookmarks/bookmark_editor.h" |
13 #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h" | 16 #include "components/bookmarks/browser/bookmark_expanded_state_tracker.h" |
14 #include "components/bookmarks/browser/bookmark_model_observer.h" | 17 #include "components/bookmarks/browser/bookmark_model_observer.h" |
15 #include "ui/base/models/simple_menu_model.h" | 18 #include "ui/base/models/simple_menu_model.h" |
16 #include "ui/base/models/tree_node_model.h" | 19 #include "ui/base/models/tree_node_model.h" |
17 #include "ui/views/context_menu_controller.h" | 20 #include "ui/views/context_menu_controller.h" |
18 #include "ui/views/controls/button/button.h" | 21 #include "ui/views/controls/button/button.h" |
19 #include "ui/views/controls/textfield/textfield.h" | 22 #include "ui/views/controls/textfield/textfield.h" |
20 #include "ui/views/controls/textfield/textfield_controller.h" | 23 #include "ui/views/controls/textfield/textfield_controller.h" |
(...skipping 25 matching lines...) Expand all Loading... |
46 class BookmarkEditorView : public BookmarkEditor, | 49 class BookmarkEditorView : public BookmarkEditor, |
47 public views::ButtonListener, | 50 public views::ButtonListener, |
48 public views::TreeViewController, | 51 public views::TreeViewController, |
49 public views::DialogDelegateView, | 52 public views::DialogDelegateView, |
50 public views::TextfieldController, | 53 public views::TextfieldController, |
51 public views::ContextMenuController, | 54 public views::ContextMenuController, |
52 public ui::SimpleMenuModel::Delegate, | 55 public ui::SimpleMenuModel::Delegate, |
53 public bookmarks::BookmarkModelObserver { | 56 public bookmarks::BookmarkModelObserver { |
54 public: | 57 public: |
55 // Type of node in the tree. Public purely for testing. | 58 // Type of node in the tree. Public purely for testing. |
56 typedef ui::TreeNodeWithValue<int64> EditorNode; | 59 typedef ui::TreeNodeWithValue<int64_t> EditorNode; |
57 | 60 |
58 // Model for the TreeView. Trivial subclass that doesn't allow titles with | 61 // Model for the TreeView. Trivial subclass that doesn't allow titles with |
59 // empty strings. Public purely for testing. | 62 // empty strings. Public purely for testing. |
60 class EditorTreeModel : public ui::TreeNodeModel<EditorNode> { | 63 class EditorTreeModel : public ui::TreeNodeModel<EditorNode> { |
61 public: | 64 public: |
62 explicit EditorTreeModel(EditorNode* root) | 65 explicit EditorTreeModel(EditorNode* root) |
63 : ui::TreeNodeModel<EditorNode>(root) {} | 66 : ui::TreeNodeModel<EditorNode>(root) {} |
64 | 67 |
65 void SetTitle(ui::TreeModelNode* node, | 68 void SetTitle(ui::TreeModelNode* node, |
66 const base::string16& title) override; | 69 const base::string16& title) override; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 169 |
167 // Creates a returns the new root node. This invokes CreateNodes to do | 170 // Creates a returns the new root node. This invokes CreateNodes to do |
168 // the real work. | 171 // the real work. |
169 EditorNode* CreateRootNode(); | 172 EditorNode* CreateRootNode(); |
170 | 173 |
171 // Adds and creates a child node in b_node for all children of bb_node that | 174 // Adds and creates a child node in b_node for all children of bb_node that |
172 // are folders. | 175 // are folders. |
173 void CreateNodes(const bookmarks::BookmarkNode* bb_node, EditorNode* b_node); | 176 void CreateNodes(const bookmarks::BookmarkNode* bb_node, EditorNode* b_node); |
174 | 177 |
175 // Returns the node with the specified id, or NULL if one can't be found. | 178 // Returns the node with the specified id, or NULL if one can't be found. |
176 EditorNode* FindNodeWithID(BookmarkEditorView::EditorNode* node, int64 id); | 179 EditorNode* FindNodeWithID(BookmarkEditorView::EditorNode* node, int64_t id); |
177 | 180 |
178 // Invokes ApplyEdits with the selected node. | 181 // Invokes ApplyEdits with the selected node. |
179 void ApplyEdits(); | 182 void ApplyEdits(); |
180 | 183 |
181 // Applies the edits done by the user. |parent| gives the parent of the URL | 184 // Applies the edits done by the user. |parent| gives the parent of the URL |
182 // being edited. | 185 // being edited. |
183 void ApplyEdits(EditorNode* parent); | 186 void ApplyEdits(EditorNode* parent); |
184 | 187 |
185 // Recursively adds newly created folders and sets the title of nodes to | 188 // Recursively adds newly created folders and sets the title of nodes to |
186 // match the user edited title. | 189 // match the user edited title. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 bookmarks::BookmarkModel* bb_model_; | 263 bookmarks::BookmarkModel* bb_model_; |
261 | 264 |
262 // If true, we're running the menu for the bookmark bar or other bookmarks | 265 // If true, we're running the menu for the bookmark bar or other bookmarks |
263 // nodes. | 266 // nodes. |
264 bool running_menu_for_root_; | 267 bool running_menu_for_root_; |
265 | 268 |
266 // Is the tree shown? | 269 // Is the tree shown? |
267 bool show_tree_; | 270 bool show_tree_; |
268 | 271 |
269 // List of deleted bookmark folders. | 272 // List of deleted bookmark folders. |
270 std::vector<int64> deletes_; | 273 std::vector<int64_t> deletes_; |
271 | 274 |
272 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorView); | 275 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorView); |
273 }; | 276 }; |
274 | 277 |
275 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_EDITOR_VIEW_H_ | 278 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_EDITOR_VIEW_H_ |
OLD | NEW |