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

Side by Side Diff: chrome/browser/app_menu_model.h

Issue 523147: Made MenuController handle dynamic labels. (Closed)
Patch Set: Addressed pinkerton's comments. Created 10 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/app_menu_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_APP_MENU_MODEL_H_ 5 #ifndef CHROME_BROWSER_APP_MENU_MODEL_H_
6 #define CHROME_BROWSER_APP_MENU_MODEL_H_ 6 #define CHROME_BROWSER_APP_MENU_MODEL_H_
7 7
8 #include "app/menus/simple_menu_model.h" 8 #include "app/menus/simple_menu_model.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "chrome/browser/user_data_manager.h" 11 #include "chrome/browser/user_data_manager.h"
12 12
13 class Browser; 13 class Browser;
14 14
15 // A menu model that builds the contents of the app menu. This menu has only 15 // A menu model that builds the contents of the app menu. This menu has only
16 // one level (no submenus). 16 // one level (no submenus).
17 class AppMenuModel : public menus::SimpleMenuModel { 17 class AppMenuModel : public menus::SimpleMenuModel {
18 public: 18 public:
19 explicit AppMenuModel(menus::SimpleMenuModel::Delegate* delegate, 19 explicit AppMenuModel(menus::SimpleMenuModel::Delegate* delegate,
20 Browser* browser); 20 Browser* browser);
21 virtual ~AppMenuModel(); 21 virtual ~AppMenuModel();
22 22
23 // Override this to handle the sync menu item (whose label is
24 // updated dynamically).
25 virtual bool IsLabelDynamicAt(int index) const;
26 virtual string16 GetLabelAt(int index) const;
27
23 private: 28 private:
24 void Build(); 29 void Build();
25 void BuildProfileSubMenu(); 30 void BuildProfileSubMenu();
26 31
32 string16 GetSyncMenuLabel() const;
33 bool IsSyncItem(int index) const;
34
27 // Contents of the profiles menu to populate with profile names. 35 // Contents of the profiles menu to populate with profile names.
28 scoped_ptr<menus::SimpleMenuModel> profiles_menu_contents_; 36 scoped_ptr<menus::SimpleMenuModel> profiles_menu_contents_;
29 37
30 Browser* browser_; // weak 38 Browser* browser_; // weak
31 39
40 bool sync_item_enabled_;
41 int sync_item_index_; // -1 if sync_item_enabled_ is false.
42
32 DISALLOW_COPY_AND_ASSIGN(AppMenuModel); 43 DISALLOW_COPY_AND_ASSIGN(AppMenuModel);
33 }; 44 };
34 45
35 #endif // CHROME_BROWSER_APP_MENU_MODEL_H_ 46 #endif // CHROME_BROWSER_APP_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/app_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698