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

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

Issue 11410067: alternate ntp: favicons and menu width enhancements for "Recent tabs" menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed typo Created 8 years, 1 month 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 | Annotate | Revision Log
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"
11 #include "chrome/browser/favicon/favicon_service.h" 11 #include "chrome/browser/favicon/favicon_service.h"
12 #include "chrome/browser/sessions/tab_restore_service.h" 12 #include "chrome/browser/sessions/tab_restore_service.h"
13 #include "chrome/browser/sync/glue/synced_session.h"
13 #include "ui/base/accelerators/accelerator.h" 14 #include "ui/base/accelerators/accelerator.h"
14 #include "ui/base/models/simple_menu_model.h" 15 #include "ui/base/models/simple_menu_model.h"
15 16
16 class Browser; 17 class Browser;
17 struct SessionTab; 18 struct SessionTab;
18 19
19 namespace browser_sync { 20 namespace browser_sync {
20 class SessionModelAssociator; 21 class SessionModelAssociator;
21 } 22 }
22 23
(...skipping 29 matching lines...) Expand all
52 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE; 53 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
53 54
54 private: 55 private:
55 struct NavigationItem; 56 struct NavigationItem;
56 typedef std::vector<NavigationItem> NavigationItems; 57 typedef std::vector<NavigationItem> NavigationItems;
57 58
58 // Build the menu items by populating the model. 59 // Build the menu items by populating the model.
59 void Build(); 60 void Build();
60 void BuildLastClosed(); 61 void BuildLastClosed();
61 void BuildDevices(); 62 void BuildDevices();
62 void BuildForeignTabItem(const std::string& session_tag, 63 void BuildForeignTabItem(
63 const SessionTab& tab, 64 const std::string& session_tag,
64 const std::string& session_name, 65 const SessionTab& tab,
65 bool need_separator); 66 const std::string& session_name,
66 void AddFavicon(int model_index, int command_id, const GURL& url); 67 browser_sync::SyncedSession::DeviceType device_type,
68 bool need_separator);
69 void AddDeviceFavicon(int index_in_menu,
70 browser_sync::SyncedSession::DeviceType device_type);
71 void AddTabFavicon(int model_index, int command_id, const GURL& url);
67 void OnFaviconDataAvailable(FaviconService::Handle handle, 72 void OnFaviconDataAvailable(FaviconService::Handle handle,
68 const history::FaviconImageResult& image_result); 73 const history::FaviconImageResult& image_result);
69 browser_sync::SessionModelAssociator* GetModelAssociator(); 74 browser_sync::SessionModelAssociator* GetModelAssociator();
70 75
71 Browser* browser_; // Weak. 76 Browser* browser_; // Weak.
72 77
73 browser_sync::SessionModelAssociator* associator_; // Weak. 78 browser_sync::SessionModelAssociator* associator_; // Weak.
74 79
75 // Accelerator for reopening last closed tab. 80 // Accelerator for reopening last closed tab.
76 ui::Accelerator reopen_closed_tab_accelerator_; 81 ui::Accelerator reopen_closed_tab_accelerator_;
77 82
78 // Navigation items. The |command_id| is set to kFirstTabCommandId plus the 83 // Navigation items. The |command_id| is set to kFirstTabCommandId plus the
79 // index into this vector. Upon invocation of the menu, the navigation 84 // index into this vector. Upon invocation of the menu, the navigation
80 // information is retrieved from |model_| and used to navigate to the item 85 // information is retrieved from |model_| and used to navigate to the item
81 // specified. 86 // specified.
82 NavigationItems model_; 87 NavigationItems model_;
83 88
84 gfx::Image default_favicon_; 89 gfx::Image default_favicon_;
85 90
86 CancelableRequestConsumerTSimple<int> favicon_consumer_; 91 CancelableRequestConsumerTSimple<int> favicon_consumer_;
87 92
88 base::WeakPtrFactory<RecentTabsSubMenuModel> weak_ptr_factory_; 93 base::WeakPtrFactory<RecentTabsSubMenuModel> weak_ptr_factory_;
89 94
90 DISALLOW_COPY_AND_ASSIGN(RecentTabsSubMenuModel); 95 DISALLOW_COPY_AND_ASSIGN(RecentTabsSubMenuModel);
91 }; 96 };
92 97
93 #endif // CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_SUB_MENU_MODEL_H_ 98 #endif // CHROME_BROWSER_UI_TOOLBAR_RECENT_TABS_SUB_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('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