OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_VIEWS_DELEGATE_H_ | 5 #ifndef UI_VIEWS_VIEWS_DELEGATE_H_ |
6 #define UI_VIEWS_VIEWS_DELEGATE_H_ | 6 #define UI_VIEWS_VIEWS_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 public: | 66 public: |
67 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
68 enum AppbarAutohideEdge { | 68 enum AppbarAutohideEdge { |
69 EDGE_TOP = 1 << 0, | 69 EDGE_TOP = 1 << 0, |
70 EDGE_LEFT = 1 << 1, | 70 EDGE_LEFT = 1 << 1, |
71 EDGE_BOTTOM = 1 << 2, | 71 EDGE_BOTTOM = 1 << 2, |
72 EDGE_RIGHT = 1 << 3, | 72 EDGE_RIGHT = 1 << 3, |
73 }; | 73 }; |
74 #endif | 74 #endif |
75 | 75 |
| 76 enum class ProcessMenuAcceleratorResult { |
| 77 // The accelerator was handled while the menu was showing. No further action |
| 78 // is needed and the menu should be kept open. |
| 79 LEAVE_MENU_OPEN, |
| 80 |
| 81 // The accelerator was not handled. Menu should be closed and the |
| 82 // accelerator will be reposted to be handled after the menu closes. |
| 83 CLOSE_MENU |
| 84 }; |
| 85 |
76 virtual ~ViewsDelegate(); | 86 virtual ~ViewsDelegate(); |
77 | 87 |
78 // Returns the ViewsDelegate instance if there is one, or nullptr otherwise. | 88 // Returns the ViewsDelegate instance if there is one, or nullptr otherwise. |
79 static ViewsDelegate* GetInstance(); | 89 static ViewsDelegate* GetInstance(); |
80 | 90 |
81 // Saves the position, size and "show" state for the window with the | 91 // Saves the position, size and "show" state for the window with the |
82 // specified name. | 92 // specified name. |
83 virtual void SaveWindowPlacement(const Widget* widget, | 93 virtual void SaveWindowPlacement(const Widget* widget, |
84 const std::string& window_name, | 94 const std::string& window_name, |
85 const gfx::Rect& bounds, | 95 const gfx::Rect& bounds, |
86 ui::WindowShowState show_state); | 96 ui::WindowShowState show_state); |
87 | 97 |
88 // Retrieves the saved position and size and "show" state for the window with | 98 // Retrieves the saved position and size and "show" state for the window with |
89 // the specified name. | 99 // the specified name. |
90 virtual bool GetSavedWindowPlacement(const Widget* widget, | 100 virtual bool GetSavedWindowPlacement(const Widget* widget, |
91 const std::string& window_name, | 101 const std::string& window_name, |
92 gfx::Rect* bounds, | 102 gfx::Rect* bounds, |
93 ui::WindowShowState* show_state) const; | 103 ui::WindowShowState* show_state) const; |
94 | 104 |
95 virtual void NotifyAccessibilityEvent(View* view, ui::AXEvent event_type); | 105 virtual void NotifyAccessibilityEvent(View* view, ui::AXEvent event_type); |
96 | 106 |
97 // For accessibility, notify the delegate that a menu item was focused | 107 // For accessibility, notify the delegate that a menu item was focused |
98 // so that alternate feedback (speech / magnified text) can be provided. | 108 // so that alternate feedback (speech / magnified text) can be provided. |
99 virtual void NotifyMenuItemFocused(const base::string16& menu_name, | 109 virtual void NotifyMenuItemFocused(const base::string16& menu_name, |
100 const base::string16& menu_item_name, | 110 const base::string16& menu_item_name, |
101 int item_index, | 111 int item_index, |
102 int item_count, | 112 int item_count, |
103 bool has_submenu); | 113 bool has_submenu); |
104 | 114 |
| 115 // If |accelerator| can be processed while a menu is showing, it will be |
| 116 // processed now and LEAVE_MENU_OPEN is returned. Otherwise, |accelerator| |
| 117 // will be reposted for processing later after the menu closes and CLOSE_MENU |
| 118 // will be returned. |
| 119 virtual ProcessMenuAcceleratorResult ProcessAcceleratorWhileMenuShowing( |
| 120 const ui::Accelerator& accelerator); |
| 121 |
105 #if defined(OS_WIN) | 122 #if defined(OS_WIN) |
106 // Retrieves the default window icon to use for windows if none is specified. | 123 // Retrieves the default window icon to use for windows if none is specified. |
107 virtual HICON GetDefaultWindowIcon() const; | 124 virtual HICON GetDefaultWindowIcon() const; |
108 // Retrieves the small window icon to use for windows if none is specified. | 125 // Retrieves the small window icon to use for windows if none is specified. |
109 virtual HICON GetSmallWindowIcon() const = 0; | 126 virtual HICON GetSmallWindowIcon() const = 0; |
110 // Returns true if the window passed in is in the Windows 8 metro | 127 // Returns true if the window passed in is in the Windows 8 metro |
111 // environment. | 128 // environment. |
112 virtual bool IsWindowInMetro(gfx::NativeWindow window) const; | 129 virtual bool IsWindowInMetro(gfx::NativeWindow window) const; |
113 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) | 130 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) |
114 virtual gfx::ImageSkia* GetDefaultWindowIcon() const; | 131 virtual gfx::ImageSkia* GetDefaultWindowIcon() const; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 #if defined(USE_AURA) | 188 #if defined(USE_AURA) |
172 scoped_ptr<TouchSelectionMenuRunnerViews> touch_selection_menu_runner_; | 189 scoped_ptr<TouchSelectionMenuRunnerViews> touch_selection_menu_runner_; |
173 #endif | 190 #endif |
174 | 191 |
175 DISALLOW_COPY_AND_ASSIGN(ViewsDelegate); | 192 DISALLOW_COPY_AND_ASSIGN(ViewsDelegate); |
176 }; | 193 }; |
177 | 194 |
178 } // namespace views | 195 } // namespace views |
179 | 196 |
180 #endif // UI_VIEWS_VIEWS_DELEGATE_H_ | 197 #endif // UI_VIEWS_VIEWS_DELEGATE_H_ |
OLD | NEW |