| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual 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 virtual ~BookmarkEditorView(); |
| 79 | 79 |
| 80 // views::DialogDelegateView: | 80 // views::DialogDelegateView: |
| 81 virtual base::string16 GetDialogButtonLabel( | 81 virtual base::string16 GetDialogButtonLabel( |
| 82 ui::DialogButton button) const OVERRIDE; | 82 ui::DialogButton button) const override; |
| 83 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const OVERRIDE; | 83 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const override; |
| 84 virtual views::View* CreateExtraView() OVERRIDE; | 84 virtual views::View* CreateExtraView() override; |
| 85 virtual ui::ModalType GetModalType() const OVERRIDE; | 85 virtual ui::ModalType GetModalType() const override; |
| 86 virtual bool CanResize() const OVERRIDE; | 86 virtual bool CanResize() const override; |
| 87 virtual base::string16 GetWindowTitle() const OVERRIDE; | 87 virtual base::string16 GetWindowTitle() const override; |
| 88 virtual bool Accept() OVERRIDE; | 88 virtual bool Accept() override; |
| 89 | 89 |
| 90 // views::View: | 90 // views::View: |
| 91 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 91 virtual gfx::Size GetPreferredSize() const override; |
| 92 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 92 virtual void GetAccessibleState(ui::AXViewState* state) override; |
| 93 | 93 |
| 94 // views::TreeViewController: | 94 // views::TreeViewController: |
| 95 virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view) OVERRIDE; | 95 virtual void OnTreeViewSelectionChanged(views::TreeView* tree_view) override; |
| 96 virtual bool CanEdit(views::TreeView* tree_view, | 96 virtual bool CanEdit(views::TreeView* tree_view, |
| 97 ui::TreeModelNode* node) OVERRIDE; | 97 ui::TreeModelNode* node) override; |
| 98 | 98 |
| 99 // views::TextfieldController: | 99 // views::TextfieldController: |
| 100 virtual void ContentsChanged(views::Textfield* sender, | 100 virtual void ContentsChanged(views::Textfield* sender, |
| 101 const base::string16& new_contents) OVERRIDE; | 101 const base::string16& new_contents) override; |
| 102 virtual bool HandleKeyEvent(views::Textfield* sender, | 102 virtual bool HandleKeyEvent(views::Textfield* sender, |
| 103 const ui::KeyEvent& key_event) OVERRIDE; | 103 const ui::KeyEvent& key_event) override; |
| 104 | 104 |
| 105 // views::ButtonListener: | 105 // views::ButtonListener: |
| 106 virtual void ButtonPressed(views::Button* sender, | 106 virtual void ButtonPressed(views::Button* sender, |
| 107 const ui::Event& event) OVERRIDE; | 107 const ui::Event& event) override; |
| 108 | 108 |
| 109 // ui::SimpleMenuModel::Delegate: | 109 // ui::SimpleMenuModel::Delegate: |
| 110 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 110 virtual bool IsCommandIdChecked(int command_id) const override; |
| 111 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 111 virtual bool IsCommandIdEnabled(int command_id) const override; |
| 112 virtual bool GetAcceleratorForCommandId( | 112 virtual bool GetAcceleratorForCommandId( |
| 113 int command_id, | 113 int command_id, |
| 114 ui::Accelerator* accelerator) OVERRIDE; | 114 ui::Accelerator* accelerator) override; |
| 115 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 115 virtual void ExecuteCommand(int command_id, int event_flags) override; |
| 116 | 116 |
| 117 // Creates a Window and adds the BookmarkEditorView to it. When the window is | 117 // Creates a Window and adds the BookmarkEditorView to it. When the window is |
| 118 // closed the BookmarkEditorView is deleted. | 118 // closed the BookmarkEditorView is deleted. |
| 119 void Show(gfx::NativeWindow parent); | 119 void Show(gfx::NativeWindow parent); |
| 120 | 120 |
| 121 // views::ContextMenuController: | 121 // views::ContextMenuController: |
| 122 virtual void ShowContextMenuForView(views::View* source, | 122 virtual void ShowContextMenuForView(views::View* source, |
| 123 const gfx::Point& point, | 123 const gfx::Point& point, |
| 124 ui::MenuSourceType source_type) OVERRIDE; | 124 ui::MenuSourceType source_type) override; |
| 125 | 125 |
| 126 private: | 126 private: |
| 127 friend class BookmarkEditorViewTest; | 127 friend class BookmarkEditorViewTest; |
| 128 | 128 |
| 129 // Creates the necessary sub-views, configures them, adds them to the layout, | 129 // Creates the necessary sub-views, configures them, adds them to the layout, |
| 130 // and requests the entries to display from the database. | 130 // and requests the entries to display from the database. |
| 131 void Init(); | 131 void Init(); |
| 132 | 132 |
| 133 // BookmarkModel observer methods. Any structural change results in | 133 // BookmarkModel observer methods. Any structural change results in |
| 134 // resetting the tree model. | 134 // resetting the tree model. |
| 135 virtual void BookmarkModelLoaded(BookmarkModel* model, | 135 virtual void BookmarkModelLoaded(BookmarkModel* model, |
| 136 bool ids_reassigned) OVERRIDE {} | 136 bool ids_reassigned) override {} |
| 137 virtual void BookmarkNodeMoved(BookmarkModel* model, | 137 virtual void BookmarkNodeMoved(BookmarkModel* model, |
| 138 const BookmarkNode* old_parent, | 138 const BookmarkNode* old_parent, |
| 139 int old_index, | 139 int old_index, |
| 140 const BookmarkNode* new_parent, | 140 const BookmarkNode* new_parent, |
| 141 int new_index) OVERRIDE; | 141 int new_index) override; |
| 142 virtual void BookmarkNodeAdded(BookmarkModel* model, | 142 virtual void BookmarkNodeAdded(BookmarkModel* model, |
| 143 const BookmarkNode* parent, | 143 const BookmarkNode* parent, |
| 144 int index) OVERRIDE; | 144 int index) override; |
| 145 virtual void BookmarkNodeRemoved(BookmarkModel* model, | 145 virtual void BookmarkNodeRemoved(BookmarkModel* model, |
| 146 const BookmarkNode* parent, | 146 const BookmarkNode* parent, |
| 147 int index, | 147 int index, |
| 148 const BookmarkNode* node, | 148 const BookmarkNode* node, |
| 149 const std::set<GURL>& removed_urls) OVERRIDE; | 149 const std::set<GURL>& removed_urls) override; |
| 150 virtual void BookmarkAllUserNodesRemoved( | 150 virtual void BookmarkAllUserNodesRemoved( |
| 151 BookmarkModel* model, | 151 BookmarkModel* model, |
| 152 const std::set<GURL>& removed_urls) OVERRIDE; | 152 const std::set<GURL>& removed_urls) override; |
| 153 virtual void BookmarkNodeChanged(BookmarkModel* model, | 153 virtual void BookmarkNodeChanged(BookmarkModel* model, |
| 154 const BookmarkNode* node) OVERRIDE {} | 154 const BookmarkNode* node) override {} |
| 155 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, | 155 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, |
| 156 const BookmarkNode* node) OVERRIDE; | 156 const BookmarkNode* node) override; |
| 157 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, | 157 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, |
| 158 const BookmarkNode* node) OVERRIDE {} | 158 const BookmarkNode* node) override {} |
| 159 | 159 |
| 160 // Resets the model of the tree and updates the various buttons appropriately. | 160 // Resets the model of the tree and updates the various buttons appropriately. |
| 161 void Reset(); | 161 void Reset(); |
| 162 | 162 |
| 163 // Expands all the nodes in the tree and selects the parent node of the | 163 // 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 | 164 // url we're editing or the most recent parent if the url being editted isn't |
| 165 // starred. | 165 // starred. |
| 166 void ExpandAndSelect(); | 166 void ExpandAndSelect(); |
| 167 | 167 |
| 168 // Creates a returns the new root node. This invokes CreateNodes to do | 168 // 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? | 267 // Is the tree shown? |
| 268 bool show_tree_; | 268 bool show_tree_; |
| 269 | 269 |
| 270 // List of deleted bookmark folders. | 270 // List of deleted bookmark folders. |
| 271 std::vector<int64> deletes_; | 271 std::vector<int64> deletes_; |
| 272 | 272 |
| 273 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorView); | 273 DISALLOW_COPY_AND_ASSIGN(BookmarkEditorView); |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_EDITOR_VIEW_H_ | 276 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_EDITOR_VIEW_H_ |
| OLD | NEW |