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_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
6 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 6 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
7 | 7 |
8 #include "base/callback.h" | |
9 #include "base/memory/scoped_vector.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "mojo/public/cpp/bindings/strong_binding.h" | 8 #include "mojo/public/cpp/bindings/strong_binding.h" |
12 #include "view_manager/public/cpp/types.h" | 9 #include "view_manager/public/cpp/types.h" |
13 #include "view_manager/public/cpp/view.h" | 10 #include "view_manager/public/cpp/view.h" |
14 #include "view_manager/public/cpp/view_manager.h" | 11 #include "view_manager/public/cpp/view_manager.h" |
15 #include "view_manager/public/interfaces/view_manager.mojom.h" | 12 #include "view_manager/public/interfaces/view_manager.mojom.h" |
16 #include "window_manager/public/interfaces/window_manager.mojom.h" | 13 #include "window_manager/public/interfaces/window_manager.mojom.h" |
17 | 14 |
18 namespace mojo { | 15 namespace mojo { |
19 class Shell; | 16 class Shell; |
20 class ViewManager; | 17 class ViewManager; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 const std::string& name, | 56 const std::string& name, |
60 const std::vector<uint8_t>& data); | 57 const std::vector<uint8_t>& data); |
61 | 58 |
62 void Embed(const String& url, Id view_id); | 59 void Embed(const String& url, Id view_id); |
63 void Embed(const String& url, | 60 void Embed(const String& url, |
64 Id view_id, | 61 Id view_id, |
65 InterfaceRequest<ServiceProvider> services, | 62 InterfaceRequest<ServiceProvider> services, |
66 ServiceProviderPtr exposed_services); | 63 ServiceProviderPtr exposed_services); |
67 void Embed(Id view_id, ViewManagerClientPtr client); | 64 void Embed(Id view_id, ViewManagerClientPtr client); |
68 | 65 |
69 void set_change_acked_callback(const base::Callback<void(void)>& callback) { | 66 void set_change_acked_callback(const Callback<void(void)>& callback) { |
70 change_acked_callback_ = callback; | 67 change_acked_callback_ = callback; |
71 } | 68 } |
72 void ClearChangeAckedCallback() { | 69 void ClearChangeAckedCallback() { change_acked_callback_.reset(); } |
73 change_acked_callback_ = base::Callback<void(void)>(); | |
74 } | |
75 | 70 |
76 // Start/stop tracking views. While tracked, they can be retrieved via | 71 // Start/stop tracking views. While tracked, they can be retrieved via |
77 // ViewManager::GetViewById. | 72 // ViewManager::GetViewById. |
78 void AddView(View* view); | 73 void AddView(View* view); |
79 void RemoveView(Id view_id); | 74 void RemoveView(Id view_id); |
80 | 75 |
81 void SetViewManagerService(ViewManagerServicePtr service); | 76 void SetViewManagerService(ViewManagerServicePtr service); |
82 | 77 |
83 private: | 78 private: |
84 friend class RootObserver; | 79 friend class RootObserver; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 void OnCaptureChanged(Id capture_view_id) override; | 124 void OnCaptureChanged(Id capture_view_id) override; |
130 void OnFocusChanged(Id focused_view_id) override; | 125 void OnFocusChanged(Id focused_view_id) override; |
131 void OnActiveWindowChanged(Id focused_view_id) override; | 126 void OnActiveWindowChanged(Id focused_view_id) override; |
132 | 127 |
133 // ErrorHandler implementation. | 128 // ErrorHandler implementation. |
134 void OnConnectionError() override; | 129 void OnConnectionError() override; |
135 | 130 |
136 void RootDestroyed(View* root); | 131 void RootDestroyed(View* root); |
137 | 132 |
138 void OnActionCompleted(bool success); | 133 void OnActionCompleted(bool success); |
139 void OnActionCompletedWithErrorCode(ErrorCode code); | |
140 | 134 |
141 base::Callback<void(bool)> ActionCompletedCallback(); | 135 Callback<void(bool)> ActionCompletedCallback(); |
142 base::Callback<void(ErrorCode)> ActionCompletedCallbackWithErrorCode(); | |
143 | |
144 // Callback from server for initial request of capture/focused/active views. | |
145 void OnGotFocusedAndActiveViews(uint32_t capture_view_id, | |
146 uint32_t focused_view_id, | |
147 uint32_t active_view_id); | |
148 | 136 |
149 ConnectionSpecificId connection_id_; | 137 ConnectionSpecificId connection_id_; |
150 ConnectionSpecificId next_id_; | 138 ConnectionSpecificId next_id_; |
151 | 139 |
152 std::string creator_url_; | 140 std::string creator_url_; |
153 | 141 |
154 base::Callback<void(void)> change_acked_callback_; | 142 Callback<void(void)> change_acked_callback_; |
155 | 143 |
156 ViewManagerDelegate* delegate_; | 144 ViewManagerDelegate* delegate_; |
157 | 145 |
158 View* root_; | 146 View* root_; |
159 | 147 |
160 IdToViewMap views_; | 148 IdToViewMap views_; |
161 | 149 |
162 View* capture_view_; | 150 View* capture_view_; |
163 View* focused_view_; | 151 View* focused_view_; |
164 View* activated_view_; | 152 View* activated_view_; |
165 | 153 |
166 WindowManagerPtr window_manager_; | 154 WindowManagerPtr window_manager_; |
167 Binding<WindowManagerObserver> wm_observer_binding_; | 155 Binding<WindowManagerObserver> wm_observer_binding_; |
168 | 156 |
169 Binding<ViewManagerClient> binding_; | 157 Binding<ViewManagerClient> binding_; |
170 ViewManagerServicePtr service_; | 158 ViewManagerServicePtr service_; |
171 const bool delete_on_error_; | 159 const bool delete_on_error_; |
172 | 160 |
173 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); | 161 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); |
viettrungluu
2015/02/10 22:47:11
Hmmm?
| |
174 }; | 162 }; |
175 | 163 |
176 } // namespace mojo | 164 } // namespace mojo |
177 | 165 |
178 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 166 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
OLD | NEW |