| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 namespace internal { | 55 namespace internal { |
| 56 class NativeWidgetDelegate; | 56 class NativeWidgetDelegate; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // ViewsDelegate is an interface implemented by an object using the views | 59 // ViewsDelegate is an interface implemented by an object using the views |
| 60 // framework. It is used to obtain various high level application utilities | 60 // framework. It is used to obtain various high level application utilities |
| 61 // and perform some actions such as window placement saving. | 61 // and perform some actions such as window placement saving. |
| 62 // | 62 // |
| 63 // The embedding app must set views_delegate to assign its ViewsDelegate | 63 // The embedding app must set the ViewsDelegate instance by instantiating an |
| 64 // implementation. | 64 // implementation of ViewsDelegate (the constructor will set the instance). |
| 65 class VIEWS_EXPORT ViewsDelegate { | 65 class VIEWS_EXPORT ViewsDelegate { |
| 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 ViewsDelegate(); | |
| 77 virtual ~ViewsDelegate(); | 76 virtual ~ViewsDelegate(); |
| 78 | 77 |
| 78 // Returns the ViewsDelegate instance if there is one, or nullptr otherwise. |
| 79 static ViewsDelegate* GetInstance(); |
| 80 |
| 79 // Saves the position, size and "show" state for the window with the | 81 // Saves the position, size and "show" state for the window with the |
| 80 // specified name. | 82 // specified name. |
| 81 virtual void SaveWindowPlacement(const Widget* widget, | 83 virtual void SaveWindowPlacement(const Widget* widget, |
| 82 const std::string& window_name, | 84 const std::string& window_name, |
| 83 const gfx::Rect& bounds, | 85 const gfx::Rect& bounds, |
| 84 ui::WindowShowState show_state); | 86 ui::WindowShowState show_state); |
| 85 | 87 |
| 86 // Retrieves the saved position and size and "show" state for the window with | 88 // Retrieves the saved position and size and "show" state for the window with |
| 87 // the specified name. | 89 // the specified name. |
| 88 virtual bool GetSavedWindowPlacement(const Widget* widget, | 90 virtual bool GetSavedWindowPlacement(const Widget* widget, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // not changed, |callback| is never run. | 155 // not changed, |callback| is never run. |
| 154 // | 156 // |
| 155 // The return value is a bitmask of AppbarAutohideEdge. | 157 // The return value is a bitmask of AppbarAutohideEdge. |
| 156 virtual int GetAppbarAutohideEdges(HMONITOR monitor, | 158 virtual int GetAppbarAutohideEdges(HMONITOR monitor, |
| 157 const base::Closure& callback); | 159 const base::Closure& callback); |
| 158 #endif | 160 #endif |
| 159 | 161 |
| 160 // Returns a blocking pool task runner given a TaskRunnerType. | 162 // Returns a blocking pool task runner given a TaskRunnerType. |
| 161 virtual scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner(); | 163 virtual scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner(); |
| 162 | 164 |
| 163 // The active ViewsDelegate used by the views system. | 165 protected: |
| 164 static ViewsDelegate* views_delegate; | 166 ViewsDelegate(); |
| 165 | 167 |
| 166 private: | 168 private: |
| 167 scoped_ptr<ViewsTouchEditingControllerFactory> views_tsc_factory_; | 169 scoped_ptr<ViewsTouchEditingControllerFactory> views_tsc_factory_; |
| 168 | 170 |
| 169 #if defined(USE_AURA) | 171 #if defined(USE_AURA) |
| 170 scoped_ptr<TouchSelectionMenuRunnerViews> touch_selection_menu_runner_; | 172 scoped_ptr<TouchSelectionMenuRunnerViews> touch_selection_menu_runner_; |
| 171 #endif | 173 #endif |
| 172 | 174 |
| 173 DISALLOW_COPY_AND_ASSIGN(ViewsDelegate); | 175 DISALLOW_COPY_AND_ASSIGN(ViewsDelegate); |
| 174 }; | 176 }; |
| 175 | 177 |
| 176 } // namespace views | 178 } // namespace views |
| 177 | 179 |
| 178 #endif // UI_VIEWS_VIEWS_DELEGATE_H_ | 180 #endif // UI_VIEWS_VIEWS_DELEGATE_H_ |
| OLD | NEW |