• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
menu_model()32   ui::MenuModel* menu_model() { return menu_model_.get(); }
33 
34  private:
browser()35   Browser* browser() { return menu_delegate_.browser(); }
36 
37   // Populates |model| with the appropriate contents.
38   void BuildMenu(ui::SimpleMenuModel* model);
39   void BuildSystemMenuForBrowserWindow(ui::SimpleMenuModel* model);
40   void BuildSystemMenuForAppOrPopupWindow(ui::SimpleMenuModel* model);
41 
42   // Adds items for toggling the frame type (if necessary).
43   void AddFrameToggleItems(ui::SimpleMenuModel* model);
44 
45   // Add the items to allow the window to visit the desktop of another user.
46   void AppendTeleportMenu(ui::SimpleMenuModel* model);
47 
48   SystemMenuModelDelegate menu_delegate_;
49   scoped_ptr<ui::MenuModel> menu_model_;
50   scoped_ptr<ZoomMenuModel> zoom_menu_contents_;
51   scoped_ptr<EncodingMenuModel> encoding_menu_contents_;
52 
53   DISALLOW_COPY_AND_ASSIGN(SystemMenuModelBuilder);
54 };
55 
56 #endif  // CHROME_BROWSER_UI_VIEWS_FRAME_SYSTEM_MENU_MODEL_BUILDER_H_
57