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

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

Issue 465130: Share the code that builds the page menu in a common model, make Mac and Win ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years 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
« no previous file with comments | « chrome/browser/cocoa/toolbar_controller_unittest.mm ('k') | chrome/browser/page_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')
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // LICENSE file.
4
5 #ifndef CHROME_BROWSER_PAGE_MENU_MODEL_H_
6 #define CHROME_BROWSER_PAGE_MENU_MODEL_H_
7
8 #include "app/menus/simple_menu_model.h"
9 #include "base/scoped_ptr.h"
10
11 class Browser;
12
13 // A menu model that builds the contents of an encoding menu.
14 class EncodingMenuModel : public menus::SimpleMenuModel,
15 public menus::SimpleMenuModel::Delegate {
16 public:
17 explicit EncodingMenuModel(Browser* browser);
18 virtual ~EncodingMenuModel() {}
19
20 // Overridden from menus::SimpleMenuModel::Delegate:
21 virtual bool IsCommandIdChecked(int command_id) const;
22 virtual bool IsCommandIdEnabled(int command_id) const;
23 virtual bool GetAcceleratorForCommandId(int command_id,
24 menus::Accelerator* accelerator);
25 virtual void ExecuteCommand(int command_id);
26
27 private:
28 void Build();
29
30 Browser* browser_; // weak
31
32 DISALLOW_COPY_AND_ASSIGN(EncodingMenuModel);
33 };
34
35 // A menu model that builds the contents of the zoom menu.
36 class ZoomMenuModel : public menus::SimpleMenuModel {
37 public:
38 explicit ZoomMenuModel(menus::SimpleMenuModel::Delegate* delegate);
39 virtual ~ZoomMenuModel() {}
40
41 private:
42 void Build();
43
44 DISALLOW_COPY_AND_ASSIGN(ZoomMenuModel);
45 };
46
47 // A menu model that builds the contents of the dev tools menu.
48 class DevToolsMenuModel : public menus::SimpleMenuModel {
49 public:
50 explicit DevToolsMenuModel(menus::SimpleMenuModel::Delegate* delegate);
51 virtual ~DevToolsMenuModel() {}
52
53 private:
54 void Build();
55
56 DISALLOW_COPY_AND_ASSIGN(DevToolsMenuModel);
57 };
58
59 // A menu model that builds the contents of the page menu and all of its
60 // submenus.
61 class PageMenuModel : public menus::SimpleMenuModel {
62 public:
63 explicit PageMenuModel(menus::SimpleMenuModel::Delegate* delegate,
64 Browser* browser);
65 virtual ~PageMenuModel() { }
66
67 private:
68 void Build();
69
70 // The top-level model.
71 scoped_ptr<menus::SimpleMenuModel> model_;
72 // Models for submenus referenced by model_. SimpleMenuModel only uses weak
73 // references so these must be kept for the lifetime of the top-level model.
74 scoped_ptr<ZoomMenuModel> zoom_menu_model_;
75 scoped_ptr<EncodingMenuModel> encoding_menu_model_;
76 scoped_ptr<DevToolsMenuModel> devtools_menu_model_;
77 Browser* browser_; // weak
78
79 DISALLOW_COPY_AND_ASSIGN(PageMenuModel);
80 };
81
82 #endif // CHROME_BROWSER_PAGE_MENU_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/toolbar_controller_unittest.mm ('k') | chrome/browser/page_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698