| 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/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 21 matching lines...) Expand all Loading... |
| 32 Shell* shell, | 32 Shell* shell, |
| 33 ScopedMessagePipeHandle handle, | 33 ScopedMessagePipeHandle handle, |
| 34 bool delete_on_error); | 34 bool delete_on_error); |
| 35 ~ViewManagerClientImpl() override; | 35 ~ViewManagerClientImpl() override; |
| 36 | 36 |
| 37 bool connected() const { return connected_; } | 37 bool connected() const { return connected_; } |
| 38 ConnectionSpecificId connection_id() const { return connection_id_; } | 38 ConnectionSpecificId connection_id() const { return connection_id_; } |
| 39 | 39 |
| 40 // API exposed to the view implementations that pushes local changes to the | 40 // API exposed to the view implementations that pushes local changes to the |
| 41 // service. | 41 // service. |
| 42 Id CreateView(); | |
| 43 void DestroyView(Id view_id); | 42 void DestroyView(Id view_id); |
| 44 | 43 |
| 45 // These methods take TransportIds. For views owned by the current connection, | 44 // These methods take TransportIds. For views owned by the current connection, |
| 46 // the connection id high word can be zero. In all cases, the TransportId 0x1 | 45 // the connection id high word can be zero. In all cases, the TransportId 0x1 |
| 47 // refers to the root view. | 46 // refers to the root view. |
| 48 void AddChild(Id child_id, Id parent_id); | 47 void AddChild(Id child_id, Id parent_id); |
| 49 void RemoveChild(Id child_id, Id parent_id); | 48 void RemoveChild(Id child_id, Id parent_id); |
| 50 | 49 |
| 51 void Reorder(Id view_id, Id relative_view_id, OrderDirection direction); | 50 void Reorder(Id view_id, Id relative_view_id, OrderDirection direction); |
| 52 | 51 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 76 // Start/stop tracking views. While tracked, they can be retrieved via | 75 // Start/stop tracking views. While tracked, they can be retrieved via |
| 77 // ViewManager::GetViewById. | 76 // ViewManager::GetViewById. |
| 78 void AddView(View* view); | 77 void AddView(View* view); |
| 79 void RemoveView(Id view_id); | 78 void RemoveView(Id view_id); |
| 80 | 79 |
| 81 private: | 80 private: |
| 82 friend class RootObserver; | 81 friend class RootObserver; |
| 83 | 82 |
| 84 typedef std::map<Id, View*> IdToViewMap; | 83 typedef std::map<Id, View*> IdToViewMap; |
| 85 | 84 |
| 85 Id CreateViewOnServer(); |
| 86 |
| 86 // Overridden from ViewManager: | 87 // Overridden from ViewManager: |
| 87 const std::string& GetEmbedderURL() const override; | 88 const std::string& GetEmbedderURL() const override; |
| 88 View* GetRoot() override; | 89 View* GetRoot() override; |
| 89 View* GetViewById(Id id) override; | 90 View* GetViewById(Id id) override; |
| 90 View* GetFocusedView() override; | 91 View* GetFocusedView() override; |
| 92 View* CreateView() override; |
| 91 | 93 |
| 92 // Overridden from ViewManagerClient: | 94 // Overridden from ViewManagerClient: |
| 93 void OnEmbed(ConnectionSpecificId connection_id, | 95 void OnEmbed(ConnectionSpecificId connection_id, |
| 94 const String& creator_url, | 96 const String& creator_url, |
| 95 ViewDataPtr root, | 97 ViewDataPtr root, |
| 96 InterfaceRequest<ServiceProvider> parent_services, | 98 InterfaceRequest<ServiceProvider> parent_services, |
| 97 ScopedMessagePipeHandle window_manager_pipe) override; | 99 ScopedMessagePipeHandle window_manager_pipe) override; |
| 98 void OnEmbeddedAppDisconnected(Id view_id) override; | 100 void OnEmbeddedAppDisconnected(Id view_id) override; |
| 99 void OnViewBoundsChanged(Id view_id, | 101 void OnViewBoundsChanged(Id view_id, |
| 100 RectPtr old_bounds, | 102 RectPtr old_bounds, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 113 const String& name, | 115 const String& name, |
| 114 Array<uint8_t> new_data) override; | 116 Array<uint8_t> new_data) override; |
| 115 void OnViewInputEvent(Id view_id, | 117 void OnViewInputEvent(Id view_id, |
| 116 EventPtr event, | 118 EventPtr event, |
| 117 const Callback<void()>& callback) override; | 119 const Callback<void()>& callback) override; |
| 118 | 120 |
| 119 // Overridden from WindowManagerClient: | 121 // Overridden from WindowManagerClient: |
| 120 void OnCaptureChanged(Id old_capture_view_id, | 122 void OnCaptureChanged(Id old_capture_view_id, |
| 121 Id new_capture_view_id) override; | 123 Id new_capture_view_id) override; |
| 122 void OnFocusChanged(Id old_focused_view_id, Id new_focused_view_id) override; | 124 void OnFocusChanged(Id old_focused_view_id, Id new_focused_view_id) override; |
| 123 void OnActiveWindowChanged(Id old_focused_window, | 125 void OnActiveWindowChanged(Id old_focused_view_id, |
| 124 Id new_focused_window) override; | 126 Id new_focused_view_id) override; |
| 125 | 127 |
| 126 // ErrorHandler implementation. | 128 // ErrorHandler implementation. |
| 127 void OnConnectionError() override; | 129 void OnConnectionError() override; |
| 128 | 130 |
| 129 void RootDestroyed(View* root); | 131 void RootDestroyed(View* root); |
| 130 | 132 |
| 131 void OnActionCompleted(bool success); | 133 void OnActionCompleted(bool success); |
| 132 void OnActionCompletedWithErrorCode(ErrorCode code); | 134 void OnActionCompletedWithErrorCode(ErrorCode code); |
| 133 | 135 |
| 134 base::Callback<void(bool)> ActionCompletedCallback(); | 136 base::Callback<void(bool)> ActionCompletedCallback(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 145 std::string creator_url_; | 147 std::string creator_url_; |
| 146 | 148 |
| 147 base::Callback<void(void)> change_acked_callback_; | 149 base::Callback<void(void)> change_acked_callback_; |
| 148 | 150 |
| 149 ViewManagerDelegate* delegate_; | 151 ViewManagerDelegate* delegate_; |
| 150 | 152 |
| 151 View* root_; | 153 View* root_; |
| 152 | 154 |
| 153 IdToViewMap views_; | 155 IdToViewMap views_; |
| 154 | 156 |
| 157 View* capture_view_; |
| 155 View* focused_view_; | 158 View* focused_view_; |
| 159 View* activated_view_; |
| 156 | 160 |
| 157 WindowManagerPtr window_manager_; | 161 WindowManagerPtr window_manager_; |
| 158 | 162 |
| 159 Binding<ViewManagerClient> binding_; | 163 Binding<ViewManagerClient> binding_; |
| 160 ViewManagerService* service_; | 164 ViewManagerService* service_; |
| 161 const bool delete_on_error_; | 165 const bool delete_on_error_; |
| 162 | 166 |
| 163 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); | 167 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); |
| 164 }; | 168 }; |
| 165 | 169 |
| 166 } // namespace mojo | 170 } // namespace mojo |
| 167 | 171 |
| 168 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 172 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
| OLD | NEW |