Chromium Code Reviews| 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 virtual ProcessMenuAcceleratorResult ProcessAcceleratorWhileMenuShowing( | |
|
pkotwicz
2015/09/10 19:13:00
Nit: Can you please add a comment to this function
afakhry
2015/09/10 20:57:13
Done.
| |
| 116 const ui::Accelerator& accelerator); | |
| 117 | |
| 105 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
| 106 // Retrieves the default window icon to use for windows if none is specified. | 119 // Retrieves the default window icon to use for windows if none is specified. |
| 107 virtual HICON GetDefaultWindowIcon() const; | 120 virtual HICON GetDefaultWindowIcon() const; |
| 108 // Retrieves the small window icon to use for windows if none is specified. | 121 // Retrieves the small window icon to use for windows if none is specified. |
| 109 virtual HICON GetSmallWindowIcon() const = 0; | 122 virtual HICON GetSmallWindowIcon() const = 0; |
| 110 // Returns true if the window passed in is in the Windows 8 metro | 123 // Returns true if the window passed in is in the Windows 8 metro |
| 111 // environment. | 124 // environment. |
| 112 virtual bool IsWindowInMetro(gfx::NativeWindow window) const; | 125 virtual bool IsWindowInMetro(gfx::NativeWindow window) const; |
| 113 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) | 126 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 114 virtual gfx::ImageSkia* GetDefaultWindowIcon() const; | 127 virtual gfx::ImageSkia* GetDefaultWindowIcon() const; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 #if defined(USE_AURA) | 184 #if defined(USE_AURA) |
| 172 scoped_ptr<TouchSelectionMenuRunnerViews> touch_selection_menu_runner_; | 185 scoped_ptr<TouchSelectionMenuRunnerViews> touch_selection_menu_runner_; |
| 173 #endif | 186 #endif |
| 174 | 187 |
| 175 DISALLOW_COPY_AND_ASSIGN(ViewsDelegate); | 188 DISALLOW_COPY_AND_ASSIGN(ViewsDelegate); |
| 176 }; | 189 }; |
| 177 | 190 |
| 178 } // namespace views | 191 } // namespace views |
| 179 | 192 |
| 180 #endif // UI_VIEWS_VIEWS_DELEGATE_H_ | 193 #endif // UI_VIEWS_VIEWS_DELEGATE_H_ |
| OLD | NEW |