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 MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class ViewManager; | 21 class ViewManager; |
22 class ViewManagerDelegate; | 22 class ViewManagerDelegate; |
23 class ViewManagerTransaction; | 23 class ViewManagerTransaction; |
24 | 24 |
25 // Manages the connection with the View Manager service. | 25 // Manages the connection with the View Manager service. |
26 class ViewManagerClientImpl : public ViewManager, | 26 class ViewManagerClientImpl : public ViewManager, |
27 public InterfaceImpl<ViewManagerClient>, | 27 public InterfaceImpl<ViewManagerClient>, |
28 public WindowManagerClient2 { | 28 public WindowManagerClient2 { |
29 public: | 29 public: |
30 ViewManagerClientImpl(ViewManagerDelegate* delegate, Shell* shell); | 30 ViewManagerClientImpl(ViewManagerDelegate* delegate, Shell* shell); |
31 virtual ~ViewManagerClientImpl(); | 31 ~ViewManagerClientImpl() override; |
32 | 32 |
33 bool connected() const { return connected_; } | 33 bool connected() const { return connected_; } |
34 ConnectionSpecificId connection_id() const { return connection_id_; } | 34 ConnectionSpecificId connection_id() const { return connection_id_; } |
35 | 35 |
36 // API exposed to the view implementations that pushes local changes to the | 36 // API exposed to the view implementations that pushes local changes to the |
37 // service. | 37 // service. |
38 Id CreateView(); | 38 Id CreateView(); |
39 void DestroyView(Id view_id); | 39 void DestroyView(Id view_id); |
40 | 40 |
41 // These methods take TransportIds. For views owned by the current connection, | 41 // These methods take TransportIds. For views owned by the current connection, |
(...skipping 28 matching lines...) Expand all Loading... |
70 // ViewManager::GetViewById. | 70 // ViewManager::GetViewById. |
71 void AddView(View* view); | 71 void AddView(View* view); |
72 void RemoveView(Id view_id); | 72 void RemoveView(Id view_id); |
73 | 73 |
74 private: | 74 private: |
75 friend class RootObserver; | 75 friend class RootObserver; |
76 | 76 |
77 typedef std::map<Id, View*> IdToViewMap; | 77 typedef std::map<Id, View*> IdToViewMap; |
78 | 78 |
79 // Overridden from ViewManager: | 79 // Overridden from ViewManager: |
80 virtual const std::string& GetEmbedderURL() const override; | 80 const std::string& GetEmbedderURL() const override; |
81 virtual const std::vector<View*>& GetRoots() const override; | 81 const std::vector<View*>& GetRoots() const override; |
82 virtual View* GetViewById(Id id) override; | 82 View* GetViewById(Id id) override; |
83 | 83 |
84 // Overridden from InterfaceImpl: | 84 // Overridden from InterfaceImpl: |
85 virtual void OnConnectionEstablished() override; | 85 void OnConnectionEstablished() override; |
86 | 86 |
87 // Overridden from ViewManagerClient: | 87 // Overridden from ViewManagerClient: |
88 virtual void OnEmbed(ConnectionSpecificId connection_id, | 88 void OnEmbed(ConnectionSpecificId connection_id, |
89 const String& creator_url, | 89 const String& creator_url, |
90 ViewDataPtr root, | 90 ViewDataPtr root, |
91 InterfaceRequest<ServiceProvider> services) override; | 91 InterfaceRequest<ServiceProvider> services) override; |
92 virtual void OnViewBoundsChanged(Id view_id, | 92 void OnViewBoundsChanged(Id view_id, |
93 RectPtr old_bounds, | 93 RectPtr old_bounds, |
94 RectPtr new_bounds) override; | 94 RectPtr new_bounds) override; |
95 virtual void OnViewHierarchyChanged(Id view_id, | 95 void OnViewHierarchyChanged(Id view_id, |
96 Id new_parent_id, | 96 Id new_parent_id, |
97 Id old_parent_id, | 97 Id old_parent_id, |
98 Array<ViewDataPtr> views) override; | 98 Array<ViewDataPtr> views) override; |
99 virtual void OnViewReordered(Id view_id, | 99 void OnViewReordered(Id view_id, |
100 Id relative_view_id, | 100 Id relative_view_id, |
101 OrderDirection direction) override; | 101 OrderDirection direction) override; |
102 virtual void OnViewDeleted(Id view_id) override; | 102 void OnViewDeleted(Id view_id) override; |
103 virtual void OnViewVisibilityChanged(Id view_id, bool visible) override; | 103 void OnViewVisibilityChanged(Id view_id, bool visible) override; |
104 virtual void OnViewDrawnStateChanged(Id view_id, bool drawn) override; | 104 void OnViewDrawnStateChanged(Id view_id, bool drawn) override; |
105 virtual void OnViewInputEvent(Id view_id, | 105 void OnViewInputEvent(Id view_id, |
106 EventPtr event, | 106 EventPtr event, |
107 const Callback<void()>& callback) override; | 107 const Callback<void()>& callback) override; |
108 | 108 |
109 // Overridden from WindowManagerClient2: | 109 // Overridden from WindowManagerClient2: |
110 virtual void OnWindowManagerReady() override; | 110 void OnWindowManagerReady() override; |
111 virtual void OnCaptureChanged(Id old_capture_view_id, | 111 void OnCaptureChanged(Id old_capture_view_id, |
112 Id new_capture_view_id) override; | 112 Id new_capture_view_id) override; |
113 virtual void OnFocusChanged(Id old_focused_view_id, | 113 void OnFocusChanged(Id old_focused_view_id, Id new_focused_view_id) override; |
114 Id new_focused_view_id) override; | 114 void OnActiveWindowChanged(Id old_focused_window, |
115 virtual void OnActiveWindowChanged(Id old_focused_window, | 115 Id new_focused_window) override; |
116 Id new_focused_window) override; | |
117 | 116 |
118 void RemoveRoot(View* root); | 117 void RemoveRoot(View* root); |
119 | 118 |
120 void OnActionCompleted(bool success); | 119 void OnActionCompleted(bool success); |
121 void OnActionCompletedWithErrorCode(ErrorCode code); | 120 void OnActionCompletedWithErrorCode(ErrorCode code); |
122 | 121 |
123 base::Callback<void(bool)> ActionCompletedCallback(); | 122 base::Callback<void(bool)> ActionCompletedCallback(); |
124 base::Callback<void(ErrorCode)> ActionCompletedCallbackWithErrorCode(); | 123 base::Callback<void(ErrorCode)> ActionCompletedCallbackWithErrorCode(); |
125 | 124 |
126 bool connected_; | 125 bool connected_; |
(...skipping 13 matching lines...) Expand all Loading... |
140 ViewManagerService* service_; | 139 ViewManagerService* service_; |
141 | 140 |
142 WindowManagerService2Ptr window_manager_; | 141 WindowManagerService2Ptr window_manager_; |
143 | 142 |
144 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); | 143 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); |
145 }; | 144 }; |
146 | 145 |
147 } // namespace mojo | 146 } // namespace mojo |
148 | 147 |
149 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 148 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
OLD | NEW |