OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_FRAME_BROWSER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_FRAME_BROWSER_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_FRAME_BROWSER_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_FRAME_BROWSER_VIEW_H_ |
7 | 7 |
8 #include "chrome/browser/chromeos/status/status_area_host.h" | 8 #include "chrome/browser/chromeos/status/status_area_host.h" |
9 #include "chrome/browser/views/frame/browser_view.h" | 9 #include "chrome/browser/views/frame/browser_view.h" |
10 #include "views/controls/button/button.h" | |
11 | 10 |
12 class TabStripModel; | 11 class TabStripModel; |
13 | 12 |
14 namespace menus { | 13 namespace menus { |
15 class SimpleMenuModel; | 14 class SimpleMenuModel; |
16 } // namespace menus | 15 } // namespace menus |
17 | 16 |
18 namespace views { | 17 namespace views { |
19 class ImageButton; | 18 class ImageButton; |
20 class Menu2; | 19 class Menu2; |
21 } // namespace views | 20 } // namespace views |
22 | 21 |
23 class Profile; | 22 class Profile; |
24 | 23 |
25 namespace chromeos { | 24 namespace chromeos { |
26 | 25 |
27 class BrowserStatusAreaView; | 26 class BrowserStatusAreaView; |
28 class CompactLocationBar; | 27 class CompactLocationBar; |
29 class CompactLocationBarHost; | 28 class CompactLocationBarHost; |
30 class CompactNavigationBar; | 29 class CompactNavigationBar; |
31 class StatusAreaButton; | 30 class StatusAreaButton; |
32 | 31 |
33 // chromeos::BrowserView adds ChromeOS specific controls and menus to a | 32 // chromeos::BrowserView adds ChromeOS specific controls and menus to a |
34 // BrowserView created with Browser::TYPE_NORMAL. This extender adds controls | 33 // BrowserView created with Browser::TYPE_NORMAL. This extender adds controls |
35 // to the title bar as follows: | 34 // to the title bar as follows: |
36 // ____ __ __ | 35 // ____ __ __ |
37 // [AppLauncher] / \ \ \ [StatusArea] | 36 // / \ \ \ [StatusArea] |
38 // | 37 // |
39 // and adds the system context menu to the remaining arae of the titlebar. | 38 // and adds the system context menu to the remaining arae of the titlebar. |
40 class BrowserView : public ::BrowserView, | 39 class BrowserView : public ::BrowserView, |
41 public views::ButtonListener, | |
42 public views::ContextMenuController, | 40 public views::ContextMenuController, |
43 public StatusAreaHost { | 41 public StatusAreaHost { |
44 public: | 42 public: |
45 // There are 3 ui styles, standard, compact and sidebar. | 43 // There are 3 ui styles, standard, compact and sidebar. |
46 // Standard uses the same layout as chromium/chrome browser. | 44 // Standard uses the same layout as chromium/chrome browser. |
47 // Compact mode hides the omnibox/toolbar to save the vertical real estate, | 45 // Compact mode hides the omnibox/toolbar to save the vertical real estate, |
48 // and uses QSB (compact nav bar) to launch/switch url. In sidebar mode, | 46 // and uses QSB (compact nav bar) to launch/switch url. In sidebar mode, |
49 // the tabstrip is moved to the side and the omnibox is moved on top of | 47 // the tabstrip is moved to the side and the omnibox is moved on top of |
50 // the tabstrip. | 48 // the tabstrip. |
51 enum UIStyle { | 49 enum UIStyle { |
52 StandardStyle = 0, | 50 StandardStyle = 0, |
53 CompactStyle, | 51 CompactStyle, |
54 SidebarStyle, | 52 SidebarStyle, |
55 }; | 53 }; |
56 | 54 |
57 explicit BrowserView(Browser* browser); | 55 explicit BrowserView(Browser* browser); |
58 virtual ~BrowserView(); | 56 virtual ~BrowserView(); |
59 | 57 |
60 // BrowserView overrides. | 58 // BrowserView overrides. |
61 virtual void Init(); | 59 virtual void Init(); |
62 virtual void Show(); | 60 virtual void Show(); |
63 virtual bool IsToolbarVisible() const; | 61 virtual bool IsToolbarVisible() const; |
64 virtual void SetFocusToLocationBar(bool select_all); | 62 virtual void SetFocusToLocationBar(bool select_all); |
65 virtual void ToggleCompactNavigationBar(); | 63 virtual void ToggleCompactNavigationBar(); |
66 virtual views::LayoutManager* CreateLayoutManager() const; | 64 virtual views::LayoutManager* CreateLayoutManager() const; |
67 virtual void ChildPreferredSizeChanged(View* child); | 65 virtual void ChildPreferredSizeChanged(View* child); |
68 | 66 |
69 // views::ButtonListener overrides. | |
70 virtual void ButtonPressed(views::Button* sender, const views::Event& event); | |
71 | |
72 // views::ContextMenuController overrides. | 67 // views::ContextMenuController overrides. |
73 virtual void ShowContextMenu(views::View* source, | 68 virtual void ShowContextMenu(views::View* source, |
74 const gfx::Point& p, | 69 const gfx::Point& p, |
75 bool is_mouse_gesture); | 70 bool is_mouse_gesture); |
76 | 71 |
77 // StatusAreaHost overrides. | 72 // StatusAreaHost overrides. |
78 virtual Profile* GetProfile() const; | 73 virtual Profile* GetProfile() const; |
79 virtual gfx::NativeWindow GetNativeWindow() const; | 74 virtual gfx::NativeWindow GetNativeWindow() const; |
80 virtual bool ShouldOpenButtonOptions( | 75 virtual bool ShouldOpenButtonOptions( |
81 const views::View* button_view) const; | 76 const views::View* button_view) const; |
(...skipping 11 matching lines...) Expand all Loading... |
93 | 88 |
94 private: | 89 private: |
95 friend class CompactLocationBarHostTest; | 90 friend class CompactLocationBarHostTest; |
96 | 91 |
97 CompactLocationBarHost* compact_location_bar_host() { | 92 CompactLocationBarHost* compact_location_bar_host() { |
98 return compact_location_bar_host_.get(); | 93 return compact_location_bar_host_.get(); |
99 } | 94 } |
100 | 95 |
101 void InitSystemMenu(); | 96 void InitSystemMenu(); |
102 | 97 |
103 // AppLauncher button. | |
104 views::ImageButton* main_menu_button_; | |
105 | |
106 // Status Area view. | 98 // Status Area view. |
107 BrowserStatusAreaView* status_area_; | 99 BrowserStatusAreaView* status_area_; |
108 | 100 |
109 // System menus. | 101 // System menus. |
110 scoped_ptr<menus::SimpleMenuModel> system_menu_contents_; | 102 scoped_ptr<menus::SimpleMenuModel> system_menu_contents_; |
111 scoped_ptr<views::Menu2> system_menu_menu_; | 103 scoped_ptr<views::Menu2> system_menu_menu_; |
112 | 104 |
113 // CompactNavigationBar view. | 105 // CompactNavigationBar view. |
114 CompactNavigationBar* compact_navigation_bar_; | 106 CompactNavigationBar* compact_navigation_bar_; |
115 | 107 |
(...skipping 15 matching lines...) Expand all Loading... |
131 | 123 |
132 // Menu button shown in status area when browser is in compact mode. | 124 // Menu button shown in status area when browser is in compact mode. |
133 StatusAreaButton* menu_view_; | 125 StatusAreaButton* menu_view_; |
134 | 126 |
135 DISALLOW_COPY_AND_ASSIGN(BrowserView); | 127 DISALLOW_COPY_AND_ASSIGN(BrowserView); |
136 }; | 128 }; |
137 | 129 |
138 } // namespace chromeos | 130 } // namespace chromeos |
139 | 131 |
140 #endif // CHROME_BROWSER_CHROMEOS_FRAME_BROWSER_VIEW_H_ | 132 #endif // CHROME_BROWSER_CHROMEOS_FRAME_BROWSER_VIEW_H_ |
OLD | NEW |