OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_VIEW_MANAGER_SERVER_VIEW_DELEGATE_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_SERVER_VIEW_DELEGATE_H_ |
6 #define COMPONENTS_VIEW_MANAGER_SERVER_VIEW_DELEGATE_H_ | 6 #define COMPONENTS_VIEW_MANAGER_SERVER_VIEW_DELEGATE_H_ |
7 | 7 |
| 8 #include "components/view_manager/public/interfaces/compositor_frame.mojom.h" |
8 #include "components/view_manager/public/interfaces/view_manager_constants.mojom
.h" | 9 #include "components/view_manager/public/interfaces/view_manager_constants.mojom
.h" |
9 | 10 |
10 namespace gfx { | 11 namespace gfx { |
11 class Rect; | 12 class Rect; |
12 } | 13 } |
13 | 14 |
14 namespace mojo { | 15 namespace mojo { |
15 class ViewportMetrics; | 16 class ViewportMetrics; |
16 } | 17 } |
17 | 18 |
| 19 namespace surfaces { |
| 20 class SurfacesState; |
| 21 } |
| 22 |
18 namespace view_manager { | 23 namespace view_manager { |
19 | 24 |
20 class ServerView; | 25 class ServerView; |
21 | 26 |
22 // ServerViewDelegate is notified at key points in the lifetime of a | 27 // ServerViewDelegate is notified at key points in the lifetime of a |
23 // ServerView. Some of the functions are similar to that of | 28 // ServerView. Some of the functions are similar to that of |
24 // ServerViewObserver. For example, ServerViewDelegate::PrepareToDestroyView() | 29 // ServerViewObserver. For example, ServerViewDelegate::PrepareToDestroyView() |
25 // and ServerViewObserver::OnWillDestroyView(). The key difference between | 30 // and ServerViewObserver::OnWillDestroyView(). The key difference between |
26 // the two are the ServerViewDelegate ones are always notified first, and | 31 // the two are the ServerViewDelegate ones are always notified first, and |
27 // ServerViewDelegate gets non-const arguments. | 32 // ServerViewDelegate gets non-const arguments. |
28 class ServerViewDelegate { | 33 class ServerViewDelegate { |
29 public: | 34 public: |
| 35 virtual surfaces::SurfacesState* GetSurfacesState() = 0; |
| 36 |
30 // Invoked when a view is about to be destroyed; before any of the children | 37 // Invoked when a view is about to be destroyed; before any of the children |
31 // have been removed and before the view has been removed from its parent. | 38 // have been removed and before the view has been removed from its parent. |
32 virtual void PrepareToDestroyView(ServerView* view) = 0; | 39 virtual void PrepareToDestroyView(ServerView* view) = 0; |
33 | 40 |
34 virtual void PrepareToChangeViewHierarchy(ServerView* view, | 41 virtual void PrepareToChangeViewHierarchy(ServerView* view, |
35 ServerView* new_parent, | 42 ServerView* new_parent, |
36 ServerView* old_parent) = 0; | 43 ServerView* old_parent) = 0; |
37 | 44 |
38 virtual void PrepareToChangeViewVisibility(ServerView* view) = 0; | 45 virtual void PrepareToChangeViewVisibility(ServerView* view) = 0; |
39 | 46 |
40 virtual void OnScheduleViewPaint(const ServerView* view) = 0; | 47 virtual void OnScheduleViewPaint(const ServerView* view) = 0; |
41 | 48 |
42 // Returns the root of the view tree to which this |view| is attached. Returns | 49 // Returns the root of the view tree to which this |view| is attached. Returns |
43 // null if this view is not attached up through to a root view. | 50 // null if this view is not attached up through to a root view. |
44 virtual const ServerView* GetRootView(const ServerView* view) const = 0; | 51 virtual const ServerView* GetRootView(const ServerView* view) const = 0; |
45 | 52 |
46 protected: | 53 protected: |
47 virtual ~ServerViewDelegate() {} | 54 virtual ~ServerViewDelegate() {} |
48 }; | 55 }; |
49 | 56 |
50 } // namespace view_manager | 57 } // namespace view_manager |
51 | 58 |
52 #endif // COMPONENTS_VIEW_MANAGER_SERVER_VIEW_DELEGATE_H_ | 59 #endif // COMPONENTS_VIEW_MANAGER_SERVER_VIEW_DELEGATE_H_ |
OLD | NEW |