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_TOOLBAR_BACK_FORWARD_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_BACK_FORWARD_MENU_MODEL_H_ |
6 #define CHROME_BROWSER_UI_TOOLBAR_BACK_FORWARD_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_BACK_FORWARD_MENU_MODEL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // browser window using View::GetViewByID. | 44 // browser window using View::GetViewByID. |
45 enum ModelType { | 45 enum ModelType { |
46 FORWARD_MENU = 1, | 46 FORWARD_MENU = 1, |
47 BACKWARD_MENU = 2 | 47 BACKWARD_MENU = 2 |
48 }; | 48 }; |
49 | 49 |
50 BackForwardMenuModel(Browser* browser, ModelType model_type); | 50 BackForwardMenuModel(Browser* browser, ModelType model_type); |
51 virtual ~BackForwardMenuModel(); | 51 virtual ~BackForwardMenuModel(); |
52 | 52 |
53 // MenuModel implementation. | 53 // MenuModel implementation. |
54 virtual bool HasIcons() const OVERRIDE; | 54 virtual bool HasIcons() const override; |
55 // Returns how many items the menu should show, including history items, | 55 // Returns how many items the menu should show, including history items, |
56 // chapter-stops, separators and the Show Full History link. This function | 56 // chapter-stops, separators and the Show Full History link. This function |
57 // uses GetHistoryItemCount() and GetChapterStopCount() internally to figure | 57 // uses GetHistoryItemCount() and GetChapterStopCount() internally to figure |
58 // out the total number of items to show. | 58 // out the total number of items to show. |
59 virtual int GetItemCount() const OVERRIDE; | 59 virtual int GetItemCount() const override; |
60 virtual ItemType GetTypeAt(int index) const OVERRIDE; | 60 virtual ItemType GetTypeAt(int index) const override; |
61 virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const OVERRIDE; | 61 virtual ui::MenuSeparatorType GetSeparatorTypeAt(int index) const override; |
62 virtual int GetCommandIdAt(int index) const OVERRIDE; | 62 virtual int GetCommandIdAt(int index) const override; |
63 virtual base::string16 GetLabelAt(int index) const OVERRIDE; | 63 virtual base::string16 GetLabelAt(int index) const override; |
64 virtual bool IsItemDynamicAt(int index) const OVERRIDE; | 64 virtual bool IsItemDynamicAt(int index) const override; |
65 virtual bool GetAcceleratorAt(int index, | 65 virtual bool GetAcceleratorAt(int index, |
66 ui::Accelerator* accelerator) const OVERRIDE; | 66 ui::Accelerator* accelerator) const override; |
67 virtual bool IsItemCheckedAt(int index) const OVERRIDE; | 67 virtual bool IsItemCheckedAt(int index) const override; |
68 virtual int GetGroupIdAt(int index) const OVERRIDE; | 68 virtual int GetGroupIdAt(int index) const override; |
69 virtual bool GetIconAt(int index, gfx::Image* icon) OVERRIDE; | 69 virtual bool GetIconAt(int index, gfx::Image* icon) override; |
70 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( | 70 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( |
71 int index) const OVERRIDE; | 71 int index) const override; |
72 virtual bool IsEnabledAt(int index) const OVERRIDE; | 72 virtual bool IsEnabledAt(int index) const override; |
73 virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; | 73 virtual MenuModel* GetSubmenuModelAt(int index) const override; |
74 virtual void HighlightChangedTo(int index) OVERRIDE; | 74 virtual void HighlightChangedTo(int index) override; |
75 virtual void ActivatedAt(int index) OVERRIDE; | 75 virtual void ActivatedAt(int index) override; |
76 virtual void ActivatedAt(int index, int event_flags) OVERRIDE; | 76 virtual void ActivatedAt(int index, int event_flags) override; |
77 virtual void MenuWillShow() OVERRIDE; | 77 virtual void MenuWillShow() override; |
78 | 78 |
79 // Is the item at |index| a separator? | 79 // Is the item at |index| a separator? |
80 bool IsSeparator(int index) const; | 80 bool IsSeparator(int index) const; |
81 | 81 |
82 // Set the delegate for triggering OnIconChanged. | 82 // Set the delegate for triggering OnIconChanged. |
83 virtual void SetMenuModelDelegate( | 83 virtual void SetMenuModelDelegate( |
84 ui::MenuModelDelegate* menu_model_delegate) OVERRIDE; | 84 ui::MenuModelDelegate* menu_model_delegate) override; |
85 virtual ui::MenuModelDelegate* GetMenuModelDelegate() const OVERRIDE; | 85 virtual ui::MenuModelDelegate* GetMenuModelDelegate() const override; |
86 | 86 |
87 protected: | 87 protected: |
88 ui::MenuModelDelegate* menu_model_delegate() { return menu_model_delegate_; } | 88 ui::MenuModelDelegate* menu_model_delegate() { return menu_model_delegate_; } |
89 | 89 |
90 private: | 90 private: |
91 friend class BackFwdMenuModelTest; | 91 friend class BackFwdMenuModelTest; |
92 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, BasicCase); | 92 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, BasicCase); |
93 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, MaxItemsTest); | 93 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, MaxItemsTest); |
94 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, ChapterStops); | 94 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, ChapterStops); |
95 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, EscapeLabel); | 95 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, EscapeLabel); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 // Used for loading favicons. | 206 // Used for loading favicons. |
207 base::CancelableTaskTracker cancelable_task_tracker_; | 207 base::CancelableTaskTracker cancelable_task_tracker_; |
208 | 208 |
209 // Used for receiving notifications when an icon is changed. | 209 // Used for receiving notifications when an icon is changed. |
210 ui::MenuModelDelegate* menu_model_delegate_; | 210 ui::MenuModelDelegate* menu_model_delegate_; |
211 | 211 |
212 DISALLOW_COPY_AND_ASSIGN(BackForwardMenuModel); | 212 DISALLOW_COPY_AND_ASSIGN(BackForwardMenuModel); |
213 }; | 213 }; |
214 | 214 |
215 #endif // CHROME_BROWSER_UI_TOOLBAR_BACK_FORWARD_MENU_MODEL_H_ | 215 #endif // CHROME_BROWSER_UI_TOOLBAR_BACK_FORWARD_MENU_MODEL_H_ |
OLD | NEW |