browser_view.h revision c407dc5cd9bdc5668497f21b26b09d988ab439de
1// Copyright (c) 2010 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_CHROMEOS_FRAME_BROWSER_VIEW_H_
6#define CHROME_BROWSER_CHROMEOS_FRAME_BROWSER_VIEW_H_
7
8#include <vector>
9
10#include "chrome/browser/chromeos/status/status_area_host.h"
11#include "chrome/browser/views/frame/browser_view.h"
12
13class AccessibleToolbarView;
14class TabStripModel;
15
16namespace menus {
17class SimpleMenuModel;
18}  // namespace menus
19
20namespace views {
21class ImageButton;
22class ImageView;
23class Menu2;
24}  // namespace views
25
26class Profile;
27
28namespace chromeos {
29
30class StatusAreaView;
31class StatusAreaButton;
32
33// chromeos::BrowserView adds ChromeOS specific controls and menus to a
34// BrowserView created with Browser::TYPE_NORMAL. This extender adds controls
35// to the title bar as follows:
36//       ____  __ __
37//      /    \   \  \     [StatusArea]
38//
39// and adds the system context menu to the remaining arae of the titlebar.
40class BrowserView : public ::BrowserView,
41                    public views::ContextMenuController,
42                    public StatusAreaHost {
43 public:
44  explicit BrowserView(Browser* browser);
45  virtual ~BrowserView();
46
47  // BrowserView overrides.
48  virtual void Init();
49  virtual void Show();
50  virtual void FocusChromeOSStatus();
51  virtual views::LayoutManager* CreateLayoutManager() const;
52  virtual void InitTabStrip(TabStripModel* tab_strip_model);
53  virtual void ChildPreferredSizeChanged(View* child);
54  virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const;
55
56  // views::ContextMenuController overrides.
57  virtual void ShowContextMenu(views::View* source,
58                               const gfx::Point& p,
59                               bool is_mouse_gesture);
60
61  // StatusAreaHost overrides.
62  virtual Profile* GetProfile() const;
63  virtual gfx::NativeWindow GetNativeWindow() const;
64  virtual bool ShouldOpenButtonOptions(
65      const views::View* button_view) const;
66  virtual void ExecuteBrowserCommand(int id) const;
67  virtual void OpenButtonOptions(const views::View* button_view) const;
68  virtual bool IsBrowserMode() const;
69  virtual bool IsScreenLockerMode() const;
70
71 protected:
72  virtual void GetAccessibleToolbars(
73      std::vector<AccessibleToolbarView*>* toolbars);
74
75 private:
76  void InitSystemMenu();
77
78  // Updates the background of the otr icon. The background differs for vertical
79  // tabs.
80  void UpdateOTRBackground();
81
82  // Status Area view.
83  StatusAreaView* status_area_;
84
85  // System menus.
86  scoped_ptr<menus::SimpleMenuModel> system_menu_contents_;
87  scoped_ptr<views::Menu2> system_menu_menu_;
88
89  // A flag to specify if the browser window should be maximized.
90  bool force_maximized_window_;
91
92  // Off the record icon.
93  views::ImageView* otr_avatar_icon_;
94
95  DISALLOW_COPY_AND_ASSIGN(BrowserView);
96};
97
98}  // namespace chromeos
99
100#endif  // CHROME_BROWSER_CHROMEOS_FRAME_BROWSER_VIEW_H_
101