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_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // |parent| is the parent for newly created nodes if |selection| is empty. | 50 // |parent| is the parent for newly created nodes if |selection| is empty. |
51 // |selection| is the nodes the context menu operates on and may be empty. | 51 // |selection| is the nodes the context menu operates on and may be empty. |
52 BookmarkContextMenuController( | 52 BookmarkContextMenuController( |
53 gfx::NativeWindow parent_window, | 53 gfx::NativeWindow parent_window, |
54 BookmarkContextMenuControllerDelegate* delegate, | 54 BookmarkContextMenuControllerDelegate* delegate, |
55 Browser* browser, | 55 Browser* browser, |
56 Profile* profile, | 56 Profile* profile, |
57 content::PageNavigator* navigator, | 57 content::PageNavigator* navigator, |
58 const BookmarkNode* parent, | 58 const BookmarkNode* parent, |
59 const std::vector<const BookmarkNode*>& selection); | 59 const std::vector<const BookmarkNode*>& selection); |
60 virtual ~BookmarkContextMenuController(); | 60 ~BookmarkContextMenuController() override; |
61 | 61 |
62 ui::SimpleMenuModel* menu_model() { return menu_model_.get(); } | 62 ui::SimpleMenuModel* menu_model() { return menu_model_.get(); } |
63 | 63 |
64 // ui::SimpleMenuModel::Delegate implementation: | 64 // ui::SimpleMenuModel::Delegate implementation: |
65 virtual bool IsCommandIdChecked(int command_id) const override; | 65 bool IsCommandIdChecked(int command_id) const override; |
66 virtual bool IsCommandIdEnabled(int command_id) const override; | 66 bool IsCommandIdEnabled(int command_id) const override; |
67 virtual bool IsCommandIdVisible(int command_id) const override; | 67 bool IsCommandIdVisible(int command_id) const override; |
68 virtual bool GetAcceleratorForCommandId( | 68 bool GetAcceleratorForCommandId(int command_id, |
69 int command_id, | 69 ui::Accelerator* accelerator) override; |
70 ui::Accelerator* accelerator) override; | 70 void ExecuteCommand(int command_id, int event_flags) override; |
71 virtual void ExecuteCommand(int command_id, int event_flags) override; | 71 bool IsItemForCommandIdDynamic(int command_id) const override; |
72 virtual bool IsItemForCommandIdDynamic(int command_id) const override; | 72 base::string16 GetLabelForCommandId(int command_id) const override; |
73 virtual base::string16 GetLabelForCommandId(int command_id) const override; | |
74 | 73 |
75 void set_navigator(content::PageNavigator* navigator) { | 74 void set_navigator(content::PageNavigator* navigator) { |
76 navigator_ = navigator; | 75 navigator_ = navigator; |
77 } | 76 } |
78 | 77 |
79 private: | 78 private: |
80 void BuildMenu(); | 79 void BuildMenu(); |
81 | 80 |
82 // Adds a IDC_* style command to the menu with a localized string. | 81 // Adds a IDC_* style command to the menu with a localized string. |
83 void AddItem(int id, int localization_id); | 82 void AddItem(int id, int localization_id); |
84 // Adds a separator to the menu. | 83 // Adds a separator to the menu. |
85 void AddSeparator(); | 84 void AddSeparator(); |
86 // Adds a checkable item to the menu. | 85 // Adds a checkable item to the menu. |
87 void AddCheckboxItem(int id, int localization_id); | 86 void AddCheckboxItem(int id, int localization_id); |
88 | 87 |
89 // Overridden from BaseBookmarkModelObserver: | 88 // Overridden from BaseBookmarkModelObserver: |
90 // Any change to the model results in closing the menu. | 89 // Any change to the model results in closing the menu. |
91 virtual void BookmarkModelChanged() override; | 90 void BookmarkModelChanged() override; |
92 | 91 |
93 gfx::NativeWindow parent_window_; | 92 gfx::NativeWindow parent_window_; |
94 BookmarkContextMenuControllerDelegate* delegate_; | 93 BookmarkContextMenuControllerDelegate* delegate_; |
95 Browser* browser_; | 94 Browser* browser_; |
96 Profile* profile_; | 95 Profile* profile_; |
97 content::PageNavigator* navigator_; | 96 content::PageNavigator* navigator_; |
98 const BookmarkNode* parent_; | 97 const BookmarkNode* parent_; |
99 std::vector<const BookmarkNode*> selection_; | 98 std::vector<const BookmarkNode*> selection_; |
100 BookmarkModel* model_; | 99 BookmarkModel* model_; |
101 scoped_ptr<ui::SimpleMenuModel> menu_model_; | 100 scoped_ptr<ui::SimpleMenuModel> menu_model_; |
102 | 101 |
103 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenuController); | 102 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenuController); |
104 }; | 103 }; |
105 | 104 |
106 #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ | 105 #endif // CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ |
OLD | NEW |