| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_RECENT_TABS_SUB_MENU_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_SUB_MENU_MODEL_H_ |
| 6 #define CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_SUB_MENU_MODEL_H_ | 6 #define CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_SUB_MENU_MODEL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 static int GetFirstRecentTabsCommandId(); | 52 static int GetFirstRecentTabsCommandId(); |
| 53 | 53 |
| 54 // If |open_tabs_delegate| is NULL, the default delegate for |browser|'s | 54 // If |open_tabs_delegate| is NULL, the default delegate for |browser|'s |
| 55 // profile will be used. Testing may require a specific |open_tabs_delegate|. | 55 // profile will be used. Testing may require a specific |open_tabs_delegate|. |
| 56 RecentTabsSubMenuModel(ui::AcceleratorProvider* accelerator_provider, | 56 RecentTabsSubMenuModel(ui::AcceleratorProvider* accelerator_provider, |
| 57 Browser* browser, | 57 Browser* browser, |
| 58 browser_sync::OpenTabsUIDelegate* open_tabs_delegate); | 58 browser_sync::OpenTabsUIDelegate* open_tabs_delegate); |
| 59 virtual ~RecentTabsSubMenuModel(); | 59 virtual ~RecentTabsSubMenuModel(); |
| 60 | 60 |
| 61 // Overridden from ui::SimpleMenuModel::Delegate: | 61 // Overridden from ui::SimpleMenuModel::Delegate: |
| 62 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 62 virtual bool IsCommandIdChecked(int command_id) const override; |
| 63 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 63 virtual bool IsCommandIdEnabled(int command_id) const override; |
| 64 virtual bool GetAcceleratorForCommandId( | 64 virtual bool GetAcceleratorForCommandId( |
| 65 int command_id, | 65 int command_id, |
| 66 ui::Accelerator* accelerator) OVERRIDE; | 66 ui::Accelerator* accelerator) override; |
| 67 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; | 67 virtual void ExecuteCommand(int command_id, int event_flags) override; |
| 68 virtual const gfx::FontList* GetLabelFontListAt(int index) const OVERRIDE; | 68 virtual const gfx::FontList* GetLabelFontListAt(int index) const override; |
| 69 | 69 |
| 70 int GetMaxWidthForItemAtIndex(int item_index) const; | 70 int GetMaxWidthForItemAtIndex(int item_index) const; |
| 71 bool GetURLAndTitleForItemAtIndex(int index, | 71 bool GetURLAndTitleForItemAtIndex(int index, |
| 72 std::string* url, | 72 std::string* url, |
| 73 base::string16* title); | 73 base::string16* title); |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 struct TabNavigationItem; | 76 struct TabNavigationItem; |
| 77 typedef std::vector<TabNavigationItem> TabNavigationItems; | 77 typedef std::vector<TabNavigationItem> TabNavigationItems; |
| 78 | 78 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 int CommandIdToTabVectorIndex(int command_id, TabNavigationItems** tab_items); | 124 int CommandIdToTabVectorIndex(int command_id, TabNavigationItems** tab_items); |
| 125 | 125 |
| 126 // Used to access (and lazily initialize) open_tabs_delegate_. | 126 // Used to access (and lazily initialize) open_tabs_delegate_. |
| 127 // TODO(tim): This lazy-init for member variables is error prone because you | 127 // TODO(tim): This lazy-init for member variables is error prone because you |
| 128 // can always skip going through the function and access the field directly. | 128 // can always skip going through the function and access the field directly. |
| 129 // Consider instead having code just deal with potentially NULL open_tabs_ | 129 // Consider instead having code just deal with potentially NULL open_tabs_ |
| 130 // and have it initialized by an event / callback. | 130 // and have it initialized by an event / callback. |
| 131 browser_sync::OpenTabsUIDelegate* GetOpenTabsUIDelegate(); | 131 browser_sync::OpenTabsUIDelegate* GetOpenTabsUIDelegate(); |
| 132 | 132 |
| 133 // Overridden from TabRestoreServiceObserver: | 133 // Overridden from TabRestoreServiceObserver: |
| 134 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; | 134 virtual void TabRestoreServiceChanged(TabRestoreService* service) override; |
| 135 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE; | 135 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) override; |
| 136 | 136 |
| 137 Browser* browser_; // Weak. | 137 Browser* browser_; // Weak. |
| 138 | 138 |
| 139 browser_sync::OpenTabsUIDelegate* open_tabs_delegate_; // Weak. | 139 browser_sync::OpenTabsUIDelegate* open_tabs_delegate_; // Weak. |
| 140 | 140 |
| 141 // Accelerator for reopening last closed tab. | 141 // Accelerator for reopening last closed tab. |
| 142 ui::Accelerator reopen_closed_tab_accelerator_; | 142 ui::Accelerator reopen_closed_tab_accelerator_; |
| 143 | 143 |
| 144 // Navigation items for local recently closed tabs. The |command_id| for | 144 // Navigation items for local recently closed tabs. The |command_id| for |
| 145 // these is set to |kFirstLocalTabCommandId| plus the index into the vector. | 145 // these is set to |kFirstLocalTabCommandId| plus the index into the vector. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 166 | 166 |
| 167 base::CancelableTaskTracker local_tab_cancelable_task_tracker_; | 167 base::CancelableTaskTracker local_tab_cancelable_task_tracker_; |
| 168 base::CancelableTaskTracker other_devices_tab_cancelable_task_tracker_; | 168 base::CancelableTaskTracker other_devices_tab_cancelable_task_tracker_; |
| 169 | 169 |
| 170 base::WeakPtrFactory<RecentTabsSubMenuModel> weak_ptr_factory_; | 170 base::WeakPtrFactory<RecentTabsSubMenuModel> weak_ptr_factory_; |
| 171 | 171 |
| 172 DISALLOW_COPY_AND_ASSIGN(RecentTabsSubMenuModel); | 172 DISALLOW_COPY_AND_ASSIGN(RecentTabsSubMenuModel); |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 #endif // CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_SUB_MENU_MODEL_H_ | 175 #endif // CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_SUB_MENU_MODEL_H_ |
| OLD | NEW |