Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 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_VIEWS_DOMUI_MENU_WIDGET_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_VIEWS_WEBUI_MENU_WIDGET_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_VIEWS_DOMUI_MENU_WIDGET_H_ | 6 #define CHROME_BROWSER_CHROMEOS_VIEWS_WEBUI_MENU_WIDGET_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "views/widget/widget_gtk.h" | 11 #include "views/widget/widget_gtk.h" |
| 12 | 12 |
| 13 class DOMView; | 13 class DOMView; |
| 14 class ExtensionApiTest; | 14 class ExtensionApiTest; |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 class MenuLocator; | 18 class MenuLocator; |
| 19 class NativeMenuDOMUI; | 19 class NativeMenuDOMUI; |
| 20 | 20 |
| 21 // DOMUIMenuWidget is a window widget for DOMUI based menu. | 21 // WebUIMenuWidget is a window widget for DOMUI based menu. |
|
Avi (use Gerrit)
2011/02/03 15:09:05
... for a Web UI based menu.
tfarina
2011/02/03 16:37:49
Done.
| |
| 22 class DOMUIMenuWidget : public views::WidgetGtk { | 22 class WebUIMenuWidget : public views::WidgetGtk { |
| 23 public: | 23 public: |
| 24 // Create a Window for the NativeMenuDMOUI. |root| specifies if | 24 // Create a Window for the NativeMenuDMOUI. |root| specifies if |
| 25 // the menu is root menu. | 25 // the menu is root menu. |
| 26 DOMUIMenuWidget(NativeMenuDOMUI* domui_menu, bool root); | 26 WebUIMenuWidget(NativeMenuDOMUI* domui_menu, bool root); |
| 27 virtual ~DOMUIMenuWidget(); | 27 virtual ~WebUIMenuWidget(); |
| 28 | 28 |
| 29 // WidgetGtk overrides: | 29 // WidgetGtk overrides: |
| 30 virtual void Init(gfx::NativeView parent, const gfx::Rect& bounds); | 30 virtual void Init(gfx::NativeView parent, const gfx::Rect& bounds); |
| 31 virtual void Hide(); | 31 virtual void Hide(); |
| 32 virtual void Close(); | 32 virtual void Close(); |
| 33 virtual void ReleaseGrab(); | 33 virtual void ReleaseGrab(); |
| 34 virtual gboolean OnGrabBrokeEvent(GtkWidget* widget, GdkEvent* event); | 34 virtual gboolean OnGrabBrokeEvent(GtkWidget* widget, GdkEvent* event); |
| 35 virtual void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); | 35 virtual void OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation); |
| 36 | 36 |
| 37 // Returns NativeMenuDOMUI that owns this widget. | 37 // Returns NativeMenuDOMUI that owns this widget. |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 65 void ShowAt(MenuLocator* locator); | 65 void ShowAt(MenuLocator* locator); |
| 66 | 66 |
| 67 // Updates the size | 67 // Updates the size |
| 68 void SetSize(const gfx::Size& new_size); | 68 void SetSize(const gfx::Size& new_size); |
| 69 | 69 |
| 70 // Returns the menu locator owned by this widget. | 70 // Returns the menu locator owned by this widget. |
| 71 const MenuLocator* menu_locator() const { | 71 const MenuLocator* menu_locator() const { |
| 72 return menu_locator_.get(); | 72 return menu_locator_.get(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 // Returns DOMUIMenuWidget that contains given native. This returns | 75 // Returns WebUIMenuWidget that contains given native. This returns |
| 76 // NULL if not found. | 76 // NULL if not found. |
| 77 static DOMUIMenuWidget* FindDOMUIMenuWidget(gfx::NativeView native); | 77 static WebUIMenuWidget* FindWebUIMenuWidget(gfx::NativeView native); |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 // Capture the X pointer grab. This also enables input on the widget by | 80 // Capture the X pointer grab. This also enables input on the widget by |
| 81 // calling EnableInput(false). | 81 // calling EnableInput(false). |
| 82 void CaptureGrab(); | 82 void CaptureGrab(); |
| 83 | 83 |
| 84 // Clears GTK grab. | 84 // Clears GTK grab. |
| 85 void ClearGrabWidget(); | 85 void ClearGrabWidget(); |
| 86 | 86 |
| 87 // NativeMenu object that owns this widget. | 87 // NativeMenu object that owns this widget. |
| 88 NativeMenuDOMUI* domui_menu_; | 88 NativeMenuDOMUI* domui_menu_; |
| 89 | 89 |
| 90 // DOMView to render the menu contents. | 90 // DOMView to render the menu contents. |
| 91 DOMView* dom_view_; | 91 DOMView* dom_view_; |
| 92 | 92 |
| 93 // MenuLocator that controls the position of this menu widget. | 93 // MenuLocator that controls the position of this menu widget. |
| 94 scoped_ptr<chromeos::MenuLocator> menu_locator_; | 94 scoped_ptr<chromeos::MenuLocator> menu_locator_; |
| 95 | 95 |
| 96 // True if the widget has input grab. | 96 // True if the widget has input grab. |
| 97 bool did_input_grab_; | 97 bool did_input_grab_; |
| 98 | 98 |
| 99 // True if the widget is for root menu (very first menu in | 99 // True if the widget is for root menu (very first menu in |
| 100 // submenu chain). | 100 // submenu chain). |
| 101 bool is_root_; | 101 bool is_root_; |
| 102 | 102 |
| 103 DISALLOW_COPY_AND_ASSIGN(DOMUIMenuWidget); | 103 DISALLOW_COPY_AND_ASSIGN(WebUIMenuWidget); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 } // namespace chromeos | 106 } // namespace chromeos |
| 107 | 107 |
| 108 #endif // CHROME_BROWSER_CHROMEOS_VIEWS_DOMUI_MENU_WIDGET_H_ | 108 #endif // CHROME_BROWSER_CHROMEOS_VIEWS_WEBUI_MENU_WIDGET_H_ |
| OLD | NEW |