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

Side by Side Diff: chrome/browser/ui/views/frame/system_menu_model_builder.h

Issue 11819008: Refactors building the system menu model into a common place (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to trunk and fix windows build Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_SYSTEM_MENU_MODEL_BUILDER_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_SYSTEM_MENU_MODEL_BUILDER_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/ui/views/frame/system_menu_model_delegate.h"
10
11 class Browser;
12 class EncodingMenuModel;
13 class ZoomMenuModel;
14
15 namespace ui {
16 class AcceleratorProvider;
17 class MenuModel;
18 class SimpleMenuModel;
19 }
20
21 // SystemMenuModelBuilder is responsible for building and owning the system menu
22 // model.
23 class SystemMenuModelBuilder {
24 public:
25 SystemMenuModelBuilder(ui::AcceleratorProvider* provider, Browser* browser);
26 ~SystemMenuModelBuilder();
27
28 // Populates the menu.
29 void Init();
30
31 // Returns the menu model. SystemMenuModelBuilder owns the returned model.
32 ui::MenuModel* menu_model() { return menu_model_.get(); }
33
34 private:
35 Browser* browser() { return menu_delegate_.browser(); }
36
37 // Creates and returns the MenuModel. This does not populate the menu.
38 // |needs_trailing_separator| is set to true if the menu needs a separator
39 // after all items have been added.
40 ui::SimpleMenuModel* CreateMenuModel(bool* needs_trailing_separator);
41
42 // Populates |model| with the appropriate contents.
43 void BuildMenu(ui::SimpleMenuModel* model);
44 void BuildSystemMenuForBrowserWindow(ui::SimpleMenuModel* model);
45 void BuildSystemMenuForAppOrPopupWindow(ui::SimpleMenuModel* model);
46
47 // Adds items for toggling the frame type (if necessary).
48 void AddFrameToggleItems(ui::SimpleMenuModel* model);
49
50 SystemMenuModelDelegate menu_delegate_;
51 scoped_ptr<ui::MenuModel> menu_model_;
52 scoped_ptr<ZoomMenuModel> zoom_menu_contents_;
53 scoped_ptr<EncodingMenuModel> encoding_menu_contents_;
54
55 DISALLOW_COPY_AND_ASSIGN(SystemMenuModelBuilder);
56 };
57
58 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_SYSTEM_MENU_MODEL_BUILDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/native_browser_frame.h ('k') | chrome/browser/ui/views/frame/system_menu_model_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698