OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 23 matching lines...) Expand all Loading... |
34 // browser window using View::GetViewByID. | 34 // browser window using View::GetViewByID. |
35 enum ModelType { | 35 enum ModelType { |
36 FORWARD_MENU = 1, | 36 FORWARD_MENU = 1, |
37 BACKWARD_MENU = 2 | 37 BACKWARD_MENU = 2 |
38 }; | 38 }; |
39 | 39 |
40 BackForwardMenuModel(Browser* browser, ModelType model_type); | 40 BackForwardMenuModel(Browser* browser, ModelType model_type); |
41 virtual ~BackForwardMenuModel(); | 41 virtual ~BackForwardMenuModel(); |
42 | 42 |
43 // MenuModel implementation. | 43 // MenuModel implementation. |
44 virtual bool HasIcons() const; | 44 virtual bool HasIcons() const OVERRIDE; |
45 // Returns how many items the menu should show, including history items, | 45 // Returns how many items the menu should show, including history items, |
46 // chapter-stops, separators and the Show Full History link. This function | 46 // chapter-stops, separators and the Show Full History link. This function |
47 // uses GetHistoryItemCount() and GetChapterStopCount() internally to figure | 47 // uses GetHistoryItemCount() and GetChapterStopCount() internally to figure |
48 // out the total number of items to show. | 48 // out the total number of items to show. |
49 virtual int GetItemCount() const; | 49 virtual int GetItemCount() const OVERRIDE; |
50 virtual ItemType GetTypeAt(int index) const; | 50 virtual ItemType GetTypeAt(int index) const OVERRIDE; |
51 virtual int GetCommandIdAt(int index) const; | 51 virtual int GetCommandIdAt(int index) const OVERRIDE; |
52 virtual string16 GetLabelAt(int index) const; | 52 virtual string16 GetLabelAt(int index) const OVERRIDE; |
53 virtual bool IsItemDynamicAt(int index) const; | 53 virtual bool IsItemDynamicAt(int index) const OVERRIDE; |
54 virtual bool GetAcceleratorAt(int index, | 54 virtual bool GetAcceleratorAt(int index, |
55 ui::Accelerator* accelerator) const; | 55 ui::Accelerator* accelerator) const OVERRIDE; |
56 virtual bool IsItemCheckedAt(int index) const; | 56 virtual bool IsItemCheckedAt(int index) const OVERRIDE; |
57 virtual int GetGroupIdAt(int index) const; | 57 virtual int GetGroupIdAt(int index) const OVERRIDE; |
58 virtual bool GetIconAt(int index, SkBitmap* icon); | 58 virtual bool GetIconAt(int index, SkBitmap* icon) OVERRIDE; |
59 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const; | 59 virtual ui::ButtonMenuItemModel* GetButtonMenuItemAt( |
60 virtual bool IsEnabledAt(int index) const; | 60 int index) const OVERRIDE; |
61 virtual MenuModel* GetSubmenuModelAt(int index) const; | 61 virtual bool IsEnabledAt(int index) const OVERRIDE; |
62 virtual void HighlightChangedTo(int index); | 62 virtual MenuModel* GetSubmenuModelAt(int index) const OVERRIDE; |
| 63 virtual void HighlightChangedTo(int index) OVERRIDE; |
63 virtual void ActivatedAt(int index) OVERRIDE; | 64 virtual void ActivatedAt(int index) OVERRIDE; |
64 virtual void ActivatedAt(int index, int event_flags) OVERRIDE; | 65 virtual void ActivatedAt(int index, int event_flags) OVERRIDE; |
65 virtual void MenuWillShow(); | 66 virtual void MenuWillShow() OVERRIDE; |
66 | 67 |
67 // Is the item at |index| a separator? | 68 // Is the item at |index| a separator? |
68 bool IsSeparator(int index) const; | 69 bool IsSeparator(int index) const; |
69 | 70 |
70 // Set the delegate for triggering OnIconChanged. | 71 // Set the delegate for triggering OnIconChanged. |
71 virtual void SetMenuModelDelegate(ui::MenuModelDelegate* menu_model_delegate); | 72 virtual void SetMenuModelDelegate( |
| 73 ui::MenuModelDelegate* menu_model_delegate) OVERRIDE; |
72 | 74 |
73 protected: | 75 protected: |
74 ui::MenuModelDelegate* menu_model_delegate() { return menu_model_delegate_; } | 76 ui::MenuModelDelegate* menu_model_delegate() { return menu_model_delegate_; } |
75 | 77 |
76 private: | 78 private: |
77 friend class BackFwdMenuModelTest; | 79 friend class BackFwdMenuModelTest; |
78 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, BasicCase); | 80 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, BasicCase); |
79 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, MaxItemsTest); | 81 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, MaxItemsTest); |
80 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, ChapterStops); | 82 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, ChapterStops); |
81 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, EscapeLabel); | 83 FRIEND_TEST_ALL_PREFIXES(BackFwdMenuModelTest, EscapeLabel); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // Used for loading favicons from history. | 192 // Used for loading favicons from history. |
191 CancelableRequestConsumerTSimple<int> load_consumer_; | 193 CancelableRequestConsumerTSimple<int> load_consumer_; |
192 | 194 |
193 // Used for receiving notifications when an icon is changed. | 195 // Used for receiving notifications when an icon is changed. |
194 ui::MenuModelDelegate* menu_model_delegate_; | 196 ui::MenuModelDelegate* menu_model_delegate_; |
195 | 197 |
196 DISALLOW_COPY_AND_ASSIGN(BackForwardMenuModel); | 198 DISALLOW_COPY_AND_ASSIGN(BackForwardMenuModel); |
197 }; | 199 }; |
198 | 200 |
199 #endif // CHROME_BROWSER_UI_TOOLBAR_BACK_FORWARD_MENU_MODEL_H_ | 201 #endif // CHROME_BROWSER_UI_TOOLBAR_BACK_FORWARD_MENU_MODEL_H_ |
OLD | NEW |