OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ |
6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 PageNavigator* navigator, | 50 PageNavigator* navigator, |
51 const BookmarkNode* parent, | 51 const BookmarkNode* parent, |
52 const std::vector<const BookmarkNode*>& selection); | 52 const std::vector<const BookmarkNode*>& selection); |
53 virtual ~BookmarkContextMenuController(); | 53 virtual ~BookmarkContextMenuController(); |
54 | 54 |
55 void BuildMenu(); | 55 void BuildMenu(); |
56 | 56 |
57 ui::SimpleMenuModel* menu_model() const { return menu_model_.get(); } | 57 ui::SimpleMenuModel* menu_model() const { return menu_model_.get(); } |
58 | 58 |
59 // ui::SimpleMenuModel::Delegate implementation: | 59 // ui::SimpleMenuModel::Delegate implementation: |
60 virtual bool IsCommandIdChecked(int command_id) const; | 60 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
61 virtual bool IsCommandIdEnabled(int command_id) const; | 61 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
62 virtual bool GetAcceleratorForCommandId(int command_id, | 62 virtual bool GetAcceleratorForCommandId( |
63 ui::Accelerator* accelerator); | 63 int command_id, |
64 virtual void ExecuteCommand(int command_id); | 64 ui::Accelerator* accelerator) OVERRIDE; |
| 65 virtual void ExecuteCommand(int command_id) OVERRIDE; |
65 | 66 |
66 // Accessors: | 67 // Accessors: |
67 Profile* profile() const { return profile_; } | 68 Profile* profile() const { return profile_; } |
68 PageNavigator* navigator() const { return navigator_; } | 69 PageNavigator* navigator() const { return navigator_; } |
69 | 70 |
70 private: | 71 private: |
71 // Adds a IDC_* style command to the menu with a localized string. | 72 // Adds a IDC_* style command to the menu with a localized string. |
72 void AddItem(int id, int localization_id); | 73 void AddItem(int id, int localization_id); |
73 // Adds a separator to the menu. | 74 // Adds a separator to the menu. |
74 void AddSeparator(); | 75 void AddSeparator(); |
75 // Adds a checkable item to the menu. | 76 // Adds a checkable item to the menu. |
76 void AddCheckboxItem(int id, int localization_id); | 77 void AddCheckboxItem(int id, int localization_id); |
77 | 78 |
78 // Overridden from BaseBookmarkModelObserver: | 79 // Overridden from BaseBookmarkModelObserver: |
79 // Any change to the model results in closing the menu. | 80 // Any change to the model results in closing the menu. |
80 virtual void BookmarkModelChanged(); | 81 virtual void BookmarkModelChanged() OVERRIDE; |
81 | 82 |
82 // Returns true if selection_ has at least one bookmark of type url. | 83 // Returns true if selection_ has at least one bookmark of type url. |
83 bool HasURLs() const; | 84 bool HasURLs() const; |
84 | 85 |
85 gfx::NativeWindow parent_window_; | 86 gfx::NativeWindow parent_window_; |
86 BookmarkContextMenuControllerDelegate* delegate_; | 87 BookmarkContextMenuControllerDelegate* delegate_; |
87 Profile* profile_; | 88 Profile* profile_; |
88 PageNavigator* navigator_; | 89 PageNavigator* navigator_; |
89 const BookmarkNode* parent_; | 90 const BookmarkNode* parent_; |
90 std::vector<const BookmarkNode*> selection_; | 91 std::vector<const BookmarkNode*> selection_; |
91 BookmarkModel* model_; | 92 BookmarkModel* model_; |
92 scoped_ptr<ui::SimpleMenuModel> menu_model_; | 93 scoped_ptr<ui::SimpleMenuModel> menu_model_; |
93 | 94 |
94 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenuController); | 95 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenuController); |
95 }; | 96 }; |
96 | 97 |
97 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ | 98 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_CONTEXT_MENU_CONTROLLER_H_ |
OLD | NEW |