Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h

Issue 1350653004: [sessions] Properly namespace recently-componentized TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mac Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 26 matching lines...) Expand all
37 37
38 namespace ui { 38 namespace ui {
39 class AcceleratorProvider; 39 class AcceleratorProvider;
40 } 40 }
41 41
42 // A menu model that builds the contents of "Recent tabs" submenu, which include 42 // A menu model that builds the contents of "Recent tabs" submenu, which include
43 // the recently closed tabs/windows of current device i.e. local entries, and 43 // the recently closed tabs/windows of current device i.e. local entries, and
44 // opened tabs of other devices. 44 // opened tabs of other devices.
45 class RecentTabsSubMenuModel : public ui::SimpleMenuModel, 45 class RecentTabsSubMenuModel : public ui::SimpleMenuModel,
46 public ui::SimpleMenuModel::Delegate, 46 public ui::SimpleMenuModel::Delegate,
47 public TabRestoreServiceObserver { 47 public sessions::TabRestoreServiceObserver {
48 public: 48 public:
49 // Command Id for recently closed items header or disabled item to which the 49 // Command Id for recently closed items header or disabled item to which the
50 // accelerator string will be appended. 50 // accelerator string will be appended.
51 static const int kRecentlyClosedHeaderCommandId; 51 static const int kRecentlyClosedHeaderCommandId;
52 static const int kDisabledRecentlyClosedHeaderCommandId; 52 static const int kDisabledRecentlyClosedHeaderCommandId;
53 53
54 // Exposed for tests only: return the Command Id for the first entry in the 54 // Exposed for tests only: return the Command Id for the first entry in the
55 // recently closed window items list. 55 // recently closed window items list.
56 static int GetFirstRecentTabsCommandId(); 56 static int GetFirstRecentTabsCommandId();
57 57
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 int CommandIdToTabVectorIndex(int command_id, TabNavigationItems** tab_items); 127 int CommandIdToTabVectorIndex(int command_id, TabNavigationItems** tab_items);
128 128
129 // Used to access (and lazily initialize) open_tabs_delegate_. 129 // Used to access (and lazily initialize) open_tabs_delegate_.
130 // TODO(tim): This lazy-init for member variables is error prone because you 130 // TODO(tim): This lazy-init for member variables is error prone because you
131 // can always skip going through the function and access the field directly. 131 // can always skip going through the function and access the field directly.
132 // Consider instead having code just deal with potentially NULL open_tabs_ 132 // Consider instead having code just deal with potentially NULL open_tabs_
133 // and have it initialized by an event / callback. 133 // and have it initialized by an event / callback.
134 sync_driver::OpenTabsUIDelegate* GetOpenTabsUIDelegate(); 134 sync_driver::OpenTabsUIDelegate* GetOpenTabsUIDelegate();
135 135
136 // Overridden from TabRestoreServiceObserver: 136 // Overridden from TabRestoreServiceObserver:
137 void TabRestoreServiceChanged(TabRestoreService* service) override; 137 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override;
138 void TabRestoreServiceDestroyed(TabRestoreService* service) override; 138 void TabRestoreServiceDestroyed(
139 sessions::TabRestoreService* service) override;
139 140
140 Browser* browser_; // Weak. 141 Browser* browser_; // Weak.
141 142
142 sync_driver::OpenTabsUIDelegate* open_tabs_delegate_; // Weak. 143 sync_driver::OpenTabsUIDelegate* open_tabs_delegate_; // Weak.
143 144
144 // Accelerator for reopening last closed tab. 145 // Accelerator for reopening last closed tab.
145 ui::Accelerator reopen_closed_tab_accelerator_; 146 ui::Accelerator reopen_closed_tab_accelerator_;
146 147
147 // Accelerator for showing history. 148 // Accelerator for showing history.
148 ui::Accelerator show_history_accelerator_; 149 ui::Accelerator show_history_accelerator_;
(...skipping 26 matching lines...) Expand all
175 176
176 // Time the menu is open for until a recent tab is selected. 177 // Time the menu is open for until a recent tab is selected.
177 base::ElapsedTimer menu_opened_timer_; 178 base::ElapsedTimer menu_opened_timer_;
178 179
179 base::WeakPtrFactory<RecentTabsSubMenuModel> weak_ptr_factory_; 180 base::WeakPtrFactory<RecentTabsSubMenuModel> weak_ptr_factory_;
180 181
181 DISALLOW_COPY_AND_ASSIGN(RecentTabsSubMenuModel); 182 DISALLOW_COPY_AND_ASSIGN(RecentTabsSubMenuModel);
182 }; 183 };
183 184
184 #endif // CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_SUB_MENU_MODEL_H_ 185 #endif // CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_SUB_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/history_menu_cocoa_controller.mm ('k') | chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698