Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: ui/views/views_delegate.h

Issue 1159033008: Refactor ViewsDelegate singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // XXX
sadrul 2015/06/08 03:27:43 ?
mohsen 2015/06/08 19:27:34 Sorry! This was here to remind me to update the co
63 // The embedding app must set views_delegate to assign its ViewsDelegate 64 // The embedding app must set views_delegate to assign its ViewsDelegate
64 // implementation. 65 // implementation.
65 class VIEWS_EXPORT ViewsDelegate { 66 class VIEWS_EXPORT ViewsDelegate {
66 public: 67 public:
67 #if defined(OS_WIN) 68 #if defined(OS_WIN)
68 enum AppbarAutohideEdge { 69 enum AppbarAutohideEdge {
69 EDGE_TOP = 1 << 0, 70 EDGE_TOP = 1 << 0,
70 EDGE_LEFT = 1 << 1, 71 EDGE_LEFT = 1 << 1,
71 EDGE_BOTTOM = 1 << 2, 72 EDGE_BOTTOM = 1 << 2,
72 EDGE_RIGHT = 1 << 3, 73 EDGE_RIGHT = 1 << 3,
73 }; 74 };
74 #endif 75 #endif
75 76
76 ViewsDelegate();
77 virtual ~ViewsDelegate(); 77 virtual ~ViewsDelegate();
78 78
79 static ViewsDelegate* GetInstance();
sadrul 2015/06/08 03:27:43 Clarify here that GetInstance() can return null if
mohsen 2015/06/08 19:27:34 Done.
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698