| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "chrome/browser/chromeos/status/status_area_host.h" | 13 #include "chrome/browser/chromeos/status/status_area_button.h" |
| 14 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
| 15 #include "chrome/browser/ui/views/frame/browser_view.h" | 15 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 16 #include "views/context_menu_controller.h" | 16 #include "views/context_menu_controller.h" |
| 17 #include "views/controls/menu/menu_listener.h" | 17 #include "views/controls/menu/menu_listener.h" |
| 18 | 18 |
| 19 class AccessibleToolbarView; | 19 class AccessibleToolbarView; |
| 20 class Profile; | 20 class Profile; |
| 21 class StatusAreaButton; |
| 21 class TabStripModel; | 22 class TabStripModel; |
| 22 | 23 |
| 23 namespace ui { | 24 namespace ui { |
| 24 class SimpleMenuModel; | 25 class SimpleMenuModel; |
| 25 } // namespace ui | 26 } // namespace ui |
| 26 | 27 |
| 27 namespace views { | 28 namespace views { |
| 28 class ImageButton; | 29 class ImageButton; |
| 29 class ImageView; | 30 class ImageView; |
| 30 class MenuDelegate; | 31 class MenuDelegate; |
| 31 class MenuItemView; | 32 class MenuItemView; |
| 32 class MenuRunner; | 33 class MenuRunner; |
| 33 } // namespace views | 34 } // namespace views |
| 34 | 35 |
| 35 namespace chromeos { | 36 namespace chromeos { |
| 36 | 37 |
| 37 class LayoutModeButton; | 38 class LayoutModeButton; |
| 38 class StatusAreaView; | 39 class StatusAreaViewChromeos; |
| 39 class StatusAreaButton; | |
| 40 | 40 |
| 41 // chromeos::BrowserView adds ChromeOS specific controls and menus to a | 41 // chromeos::BrowserView adds ChromeOS specific controls and menus to a |
| 42 // BrowserView created with Browser::TYPE_TABBED. This extender adds controls | 42 // BrowserView created with Browser::TYPE_TABBED. This extender adds controls |
| 43 // to the title bar as follows: | 43 // to the title bar as follows: |
| 44 // ____ __ __ | 44 // ____ __ __ |
| 45 // / \ \ \ [StatusArea] [LayoutModeButton] | 45 // / \ \ \ [StatusArea] [LayoutModeButton] |
| 46 // | 46 // |
| 47 // and adds the system context menu to the remaining area of the titlebar. | 47 // and adds the system context menu to the remaining area of the titlebar. |
| 48 class BrowserView : public ::BrowserView, | 48 class BrowserView : public ::BrowserView, |
| 49 public views::ContextMenuController, | 49 public views::ContextMenuController, |
| 50 public views::MenuListener, | 50 public views::MenuListener, |
| 51 public BrowserList::Observer, | 51 public BrowserList::Observer, |
| 52 public StatusAreaHost, | 52 public StatusAreaButton::Delegate, |
| 53 public MessageLoopForUI::Observer { | 53 public MessageLoopForUI::Observer { |
| 54 public: | 54 public: |
| 55 explicit BrowserView(Browser* browser); | 55 explicit BrowserView(Browser* browser); |
| 56 virtual ~BrowserView(); | 56 virtual ~BrowserView(); |
| 57 | 57 |
| 58 // BrowserView implementation. | 58 // BrowserView implementation. |
| 59 virtual void Init() OVERRIDE; | 59 virtual void Init() OVERRIDE; |
| 60 virtual void Show() OVERRIDE; | 60 virtual void Show() OVERRIDE; |
| 61 virtual void ShowInactive() OVERRIDE; | 61 virtual void ShowInactive() OVERRIDE; |
| 62 virtual void FocusChromeOSStatus() OVERRIDE; | 62 virtual void FocusChromeOSStatus() OVERRIDE; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 76 const gfx::Point& p, | 76 const gfx::Point& p, |
| 77 bool is_mouse_gesture) OVERRIDE; | 77 bool is_mouse_gesture) OVERRIDE; |
| 78 | 78 |
| 79 // views::MenuListener implementation. | 79 // views::MenuListener implementation. |
| 80 virtual void OnMenuOpened() OVERRIDE; | 80 virtual void OnMenuOpened() OVERRIDE; |
| 81 | 81 |
| 82 // BrowserList::Observer implementation. | 82 // BrowserList::Observer implementation. |
| 83 virtual void OnBrowserAdded(const Browser* browser) OVERRIDE; | 83 virtual void OnBrowserAdded(const Browser* browser) OVERRIDE; |
| 84 virtual void OnBrowserRemoved(const Browser* browser) OVERRIDE; | 84 virtual void OnBrowserRemoved(const Browser* browser) OVERRIDE; |
| 85 | 85 |
| 86 // StatusAreaHost overrides. | 86 // StatusAreaButton::Delegate overrides. |
| 87 virtual Profile* GetProfile() const OVERRIDE; | 87 virtual bool ShouldExecuteStatusAreaCommand( |
| 88 virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; | 88 const views::View* button_view, int command_id) const OVERRIDE; |
| 89 virtual bool ShouldOpenButtonOptions( | 89 virtual void ExecuteStatusAreaCommand( |
| 90 const views::View* button_view) const OVERRIDE; | 90 const views::View* button_view, int command_id) OVERRIDE; |
| 91 virtual void ExecuteBrowserCommand(int id) const OVERRIDE; | 91 virtual gfx::Font GetStatusAreaFont(const gfx::Font& font) const OVERRIDE; |
| 92 virtual void OpenButtonOptions(const views::View* button_view) OVERRIDE; | 92 virtual StatusAreaButton::TextStyle GetStatusAreaTextStyle() const OVERRIDE; |
| 93 virtual ScreenMode GetScreenMode() const OVERRIDE; | |
| 94 virtual TextStyle GetTextStyle() const OVERRIDE; | |
| 95 virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE; | 93 virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE; |
| 96 | 94 |
| 97 // MessageLoopForUI::Observer overrides. | 95 // MessageLoopForUI::Observer overrides. |
| 98 #if defined(TOUCH_UI) || defined(USE_AURA) | 96 #if defined(TOUCH_UI) || defined(USE_AURA) |
| 99 // MessageLoopForUI::Observer overrides. | 97 // MessageLoopForUI::Observer overrides. |
| 100 virtual base::EventStatus WillProcessEvent( | 98 virtual base::EventStatus WillProcessEvent( |
| 101 const base::NativeEvent& event) OVERRIDE; | 99 const base::NativeEvent& event) OVERRIDE; |
| 102 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; | 100 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; |
| 103 #else | 101 #else |
| 104 virtual void WillProcessEvent(GdkEvent* event) OVERRIDE {} | 102 virtual void WillProcessEvent(GdkEvent* event) OVERRIDE {} |
| (...skipping 24 matching lines...) Expand all Loading... |
| 129 | 127 |
| 130 void ShowInternal(bool is_active); | 128 void ShowInternal(bool is_active); |
| 131 | 129 |
| 132 // Updates |has_hide_status_area_property_| by querying the X server. | 130 // Updates |has_hide_status_area_property_| by querying the X server. |
| 133 void FetchHideStatusAreaProperty(); | 131 void FetchHideStatusAreaProperty(); |
| 134 | 132 |
| 135 // Updates |should_show_layout_mode_button_|. Changes won't be visible | 133 // Updates |should_show_layout_mode_button_|. Changes won't be visible |
| 136 // onscreen until Layout() is called. | 134 // onscreen until Layout() is called. |
| 137 void UpdateLayoutModeButtonVisibility(); | 135 void UpdateLayoutModeButtonVisibility(); |
| 138 | 136 |
| 139 StatusAreaView* status_area_; | 137 StatusAreaViewChromeos* status_area_; |
| 140 LayoutModeButton* layout_mode_button_; | 138 LayoutModeButton* layout_mode_button_; |
| 141 | 139 |
| 142 // System menu. | 140 // System menu. |
| 143 scoped_ptr<views::MenuRunner> system_menu_runner_; | 141 scoped_ptr<views::MenuRunner> system_menu_runner_; |
| 144 scoped_ptr<views::MenuDelegate> system_menu_delegate_; | 142 scoped_ptr<views::MenuDelegate> system_menu_delegate_; |
| 145 | 143 |
| 146 // Focused native widget before wrench menu shows up. We need this to properly | 144 // Focused native widget before wrench menu shows up. We need this to properly |
| 147 // perform cut, copy and paste. See http://crosbug.com/8496 | 145 // perform cut, copy and paste. See http://crosbug.com/8496 |
| 148 gfx::NativeView saved_focused_widget_; | 146 gfx::NativeView saved_focused_widget_; |
| 149 | 147 |
| 150 // Is the _CHROME_STATE_STATUS_HIDDEN atom present in our toplevel window's | 148 // Is the _CHROME_STATE_STATUS_HIDDEN atom present in our toplevel window's |
| 151 // _CHROME_STATE X property? This gets set by window manager to tell us to | 149 // _CHROME_STATE X property? This gets set by window manager to tell us to |
| 152 // hide the status area. | 150 // hide the status area. |
| 153 bool has_hide_status_area_property_; | 151 bool has_hide_status_area_property_; |
| 154 | 152 |
| 155 // Should the layout mode button be shown? We only show it if there are | 153 // Should the layout mode button be shown? We only show it if there are |
| 156 // multiple browsers open. | 154 // multiple browsers open. |
| 157 bool should_show_layout_mode_button_; | 155 bool should_show_layout_mode_button_; |
| 158 | 156 |
| 159 DISALLOW_COPY_AND_ASSIGN(BrowserView); | 157 DISALLOW_COPY_AND_ASSIGN(BrowserView); |
| 160 }; | 158 }; |
| 161 | 159 |
| 162 } // namespace chromeos | 160 } // namespace chromeos |
| 163 | 161 |
| 164 #endif // CHROME_BROWSER_CHROMEOS_FRAME_BROWSER_VIEW_H_ | 162 #endif // CHROME_BROWSER_CHROMEOS_FRAME_BROWSER_VIEW_H_ |
| OLD | NEW |