| 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_EDITOR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "app/tree_node_model.h" | 10 #include "app/tree_node_model.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 if (!title.empty()) | 62 if (!title.empty()) |
| 63 TreeNodeModel::SetTitle(node, title); | 63 TreeNodeModel::SetTitle(node, title); |
| 64 } | 64 } |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 DISALLOW_COPY_AND_ASSIGN(EditorTreeModel); | 67 DISALLOW_COPY_AND_ASSIGN(EditorTreeModel); |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 BookmarkEditorView(Profile* profile, | 70 BookmarkEditorView(Profile* profile, |
| 71 const BookmarkNode* parent, | 71 const BookmarkNode* parent, |
| 72 const BookmarkNode* node, | 72 const EditDetails& details, |
| 73 BookmarkEditor::Configuration configuration, | 73 BookmarkEditor::Configuration configuration, |
| 74 BookmarkEditor::Handler* handler); | 74 BookmarkEditor::Handler* handler); |
| 75 | 75 |
| 76 virtual ~BookmarkEditorView(); | 76 virtual ~BookmarkEditorView(); |
| 77 | 77 |
| 78 // DialogDelegate methods: | 78 // DialogDelegate methods: |
| 79 virtual bool IsDialogButtonEnabled( | 79 virtual bool IsDialogButtonEnabled( |
| 80 MessageBoxFlags::DialogButton button) const; | 80 MessageBoxFlags::DialogButton button) const; |
| 81 virtual bool IsModal() const; | 81 virtual bool IsModal() const; |
| 82 virtual std::wstring GetWindowTitle() const; | 82 virtual std::wstring GetWindowTitle() const; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Expands all the nodes in the tree and selects the parent node of the | 160 // Expands all the nodes in the tree and selects the parent node of the |
| 161 // url we're editing or the most recent parent if the url being editted isn't | 161 // url we're editing or the most recent parent if the url being editted isn't |
| 162 // starred. | 162 // starred. |
| 163 void ExpandAndSelect(); | 163 void ExpandAndSelect(); |
| 164 | 164 |
| 165 // Creates a returns the new root node. This invokes CreateNodes to do | 165 // Creates a returns the new root node. This invokes CreateNodes to do |
| 166 // the real work. | 166 // the real work. |
| 167 EditorNode* CreateRootNode(); | 167 EditorNode* CreateRootNode(); |
| 168 | 168 |
| 169 // Adds and creates a child node in b_node for all children of bb_node that | 169 // Adds and creates a child node in b_node for all children of bb_node that |
| 170 // are groups, except for |node_| if editing a folder. | 170 // are groups. |
| 171 void CreateNodes(const BookmarkNode* bb_node, EditorNode* b_node); | 171 void CreateNodes(const BookmarkNode* bb_node, EditorNode* b_node); |
| 172 | 172 |
| 173 // Returns the node with the specified id, or NULL if one can't be found. | 173 // Returns the node with the specified id, or NULL if one can't be found. |
| 174 EditorNode* FindNodeWithID(BookmarkEditorView::EditorNode* node, int64 id); | 174 EditorNode* FindNodeWithID(BookmarkEditorView::EditorNode* node, int64 id); |
| 175 | 175 |
| 176 // Invokes ApplyEdits with the selected node. | 176 // Invokes ApplyEdits with the selected node. |
| 177 void ApplyEdits(); | 177 void ApplyEdits(); |
| 178 | 178 |
| 179 // Applies the edits done by the user. |parent| gives the parent of the URL | 179 // Applies the edits done by the user. |parent| gives the parent of the URL |
| 180 // being edited. | 180 // being edited. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 208 // Creates a new group as a child of the selected node. If no node is | 208 // Creates a new group as a child of the selected node. If no node is |
| 209 // selected, the new group is added as a child of the bookmark node. Starts | 209 // selected, the new group is added as a child of the bookmark node. Starts |
| 210 // editing on the new gorup as well. | 210 // editing on the new gorup as well. |
| 211 void NewGroup(); | 211 void NewGroup(); |
| 212 | 212 |
| 213 // Creates a new EditorNode as the last child of parent. The new node is | 213 // Creates a new EditorNode as the last child of parent. The new node is |
| 214 // added to the model and returned. This does NOT start editing. This is used | 214 // added to the model and returned. This does NOT start editing. This is used |
| 215 // internally by NewGroup and broken into a separate method for testing. | 215 // internally by NewGroup and broken into a separate method for testing. |
| 216 EditorNode* AddNewGroup(EditorNode* parent); | 216 EditorNode* AddNewGroup(EditorNode* parent); |
| 217 | 217 |
| 218 // Returns true if editing a folder. | |
| 219 bool IsEditingFolder() const; | |
| 220 | |
| 221 // Profile the entry is from. | 218 // Profile the entry is from. |
| 222 Profile* profile_; | 219 Profile* profile_; |
| 223 | 220 |
| 224 // Model driving the TreeView. | 221 // Model driving the TreeView. |
| 225 scoped_ptr<EditorTreeModel> tree_model_; | 222 scoped_ptr<EditorTreeModel> tree_model_; |
| 226 | 223 |
| 227 // Displays star groups. | 224 // Displays star groups. |
| 228 views::TreeView* tree_view_; | 225 views::TreeView* tree_view_; |
| 229 | 226 |
| 230 // Used to create a new group. | 227 // Used to create a new group. |
| 231 scoped_ptr<views::NativeButton> new_group_button_; | 228 scoped_ptr<views::NativeButton> new_group_button_; |
| 232 | 229 |
| 233 // Used for editing the URL. | 230 // Used for editing the URL. |
| 234 views::Textfield url_tf_; | 231 views::Textfield url_tf_; |
| 235 | 232 |
| 236 // Used for editing the title. | 233 // Used for editing the title. |
| 237 views::Textfield title_tf_; | 234 views::Textfield title_tf_; |
| 238 | 235 |
| 239 // Initial parent to select. Is only used if node_ is NULL. | 236 // Initial parent to select. Is only used if |details_.existing_node| is |
| 237 // NULL. |
| 240 const BookmarkNode* parent_; | 238 const BookmarkNode* parent_; |
| 241 | 239 |
| 242 // Node being edited. Is NULL if creating a new node. | 240 const EditDetails details_; |
| 243 const BookmarkNode* node_; | |
| 244 | 241 |
| 245 // The context menu. | 242 // The context menu. |
| 246 scoped_ptr<views::SimpleMenuModel> context_menu_contents_; | 243 scoped_ptr<views::SimpleMenuModel> context_menu_contents_; |
| 247 scoped_ptr<views::Menu2> context_menu_; | 244 scoped_ptr<views::Menu2> context_menu_; |
| 248 | 245 |
| 249 // Mode used to create nodes from. | 246 // Mode used to create nodes from. |
| 250 BookmarkModel* bb_model_; | 247 BookmarkModel* bb_model_; |
| 251 | 248 |
| 252 // If true, we're running the menu for the bookmark bar or other bookmarks | 249 // If true, we're running the menu for the bookmark bar or other bookmarks |
| 253 // nodes. | 250 // nodes. |
| 254 bool running_menu_for_root_; | 251 bool running_menu_for_root_; |
| 255 | 252 |
| 256 // Is the tree shown? | 253 // Is the tree shown? |
| 257 bool show_tree_; | 254 bool show_tree_; |
| 258 | 255 |
| 259 scoped_ptr<BookmarkEditor::Handler> handler_; | 256 scoped_ptr<BookmarkEditor::Handler> handler_; |
| 260 | 257 |
| 261 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorView); | 258 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorView); |
| 262 }; | 259 }; |
| 263 | 260 |
| 264 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_ | 261 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_EDITOR_VIEW_H_ |
| OLD | NEW |