| 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" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "mojo/services/public/cpp/view_manager/types.h" | 12 #include "mojo/services/public/cpp/view_manager/types.h" |
| 13 #include "mojo/services/public/cpp/view_manager/view.h" | 13 #include "mojo/services/public/cpp/view_manager/view.h" |
| 14 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 14 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| 15 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 15 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
| 16 #include "mojo/services/public/interfaces/window_manager2/window_manager2.mojom.
h" | 16 #include "mojo/services/public/interfaces/window_manager/window_manager.mojom.h" |
| 17 | 17 |
| 18 namespace mojo { | 18 namespace mojo { |
| 19 class Shell; | 19 class Shell; |
| 20 class ViewManager; | 20 class ViewManager; |
| 21 class ViewManagerDelegate; | 21 class ViewManagerDelegate; |
| 22 class ViewManagerTransaction; | 22 class ViewManagerTransaction; |
| 23 | 23 |
| 24 // Manages the connection with the View Manager service. | 24 // Manages the connection with the View Manager service. |
| 25 class ViewManagerClientImpl : public ViewManager, | 25 class ViewManagerClientImpl : public ViewManager, |
| 26 public InterfaceImpl<ViewManagerClient>, | 26 public InterfaceImpl<ViewManagerClient>, |
| 27 public WindowManagerClient2 { | 27 public WindowManagerClient { |
| 28 public: | 28 public: |
| 29 ViewManagerClientImpl(ViewManagerDelegate* delegate, Shell* shell); | 29 ViewManagerClientImpl(ViewManagerDelegate* delegate, Shell* shell); |
| 30 ~ViewManagerClientImpl() override; | 30 ~ViewManagerClientImpl() override; |
| 31 | 31 |
| 32 bool connected() const { return connected_; } | 32 bool connected() const { return connected_; } |
| 33 ConnectionSpecificId connection_id() const { return connection_id_; } | 33 ConnectionSpecificId connection_id() const { return connection_id_; } |
| 34 | 34 |
| 35 // API exposed to the view implementations that pushes local changes to the | 35 // API exposed to the view implementations that pushes local changes to the |
| 36 // service. | 36 // service. |
| 37 Id CreateView(); | 37 Id CreateView(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 const std::vector<View*>& GetRoots() const override; | 83 const std::vector<View*>& GetRoots() const override; |
| 84 View* GetViewById(Id id) override; | 84 View* GetViewById(Id id) override; |
| 85 | 85 |
| 86 // Overridden from InterfaceImpl: | 86 // Overridden from InterfaceImpl: |
| 87 void OnConnectionEstablished() override; | 87 void OnConnectionEstablished() override; |
| 88 | 88 |
| 89 // Overridden from ViewManagerClient: | 89 // Overridden from ViewManagerClient: |
| 90 void OnEmbed(ConnectionSpecificId connection_id, | 90 void OnEmbed(ConnectionSpecificId connection_id, |
| 91 const String& creator_url, | 91 const String& creator_url, |
| 92 ViewDataPtr root, | 92 ViewDataPtr root, |
| 93 InterfaceRequest<ServiceProvider> services) override; | 93 InterfaceRequest<ServiceProvider> parent_services, |
| 94 ScopedMessagePipeHandle window_manager_pipe) override; |
| 94 void OnViewBoundsChanged(Id view_id, | 95 void OnViewBoundsChanged(Id view_id, |
| 95 RectPtr old_bounds, | 96 RectPtr old_bounds, |
| 96 RectPtr new_bounds) override; | 97 RectPtr new_bounds) override; |
| 97 void OnViewHierarchyChanged(Id view_id, | 98 void OnViewHierarchyChanged(Id view_id, |
| 98 Id new_parent_id, | 99 Id new_parent_id, |
| 99 Id old_parent_id, | 100 Id old_parent_id, |
| 100 Array<ViewDataPtr> views) override; | 101 Array<ViewDataPtr> views) override; |
| 101 void OnViewReordered(Id view_id, | 102 void OnViewReordered(Id view_id, |
| 102 Id relative_view_id, | 103 Id relative_view_id, |
| 103 OrderDirection direction) override; | 104 OrderDirection direction) override; |
| 104 void OnViewDeleted(Id view_id) override; | 105 void OnViewDeleted(Id view_id) override; |
| 105 void OnViewVisibilityChanged(Id view_id, bool visible) override; | 106 void OnViewVisibilityChanged(Id view_id, bool visible) override; |
| 106 void OnViewDrawnStateChanged(Id view_id, bool drawn) override; | 107 void OnViewDrawnStateChanged(Id view_id, bool drawn) override; |
| 107 void OnViewPropertyChanged(Id view_id, | 108 void OnViewPropertyChanged(Id view_id, |
| 108 const String& name, | 109 const String& name, |
| 109 Array<uint8_t> new_data) override; | 110 Array<uint8_t> new_data) override; |
| 110 void OnViewInputEvent(Id view_id, | 111 void OnViewInputEvent(Id view_id, |
| 111 EventPtr event, | 112 EventPtr event, |
| 112 const Callback<void()>& callback) override; | 113 const Callback<void()>& callback) override; |
| 113 | 114 |
| 114 // Overridden from WindowManagerClient2: | 115 // Overridden from WindowManagerClient: |
| 115 void OnWindowManagerReady() override; | |
| 116 void OnCaptureChanged(Id old_capture_view_id, | 116 void OnCaptureChanged(Id old_capture_view_id, |
| 117 Id new_capture_view_id) override; | 117 Id new_capture_view_id) override; |
| 118 void OnFocusChanged(Id old_focused_view_id, Id new_focused_view_id) override; | 118 void OnFocusChanged(Id old_focused_view_id, Id new_focused_view_id) override; |
| 119 void OnActiveWindowChanged(Id old_focused_window, | 119 void OnActiveWindowChanged(Id old_focused_window, |
| 120 Id new_focused_window) override; | 120 Id new_focused_window) override; |
| 121 | 121 |
| 122 void RemoveRoot(View* root); | 122 void RemoveRoot(View* root); |
| 123 | 123 |
| 124 void OnActionCompleted(bool success); | 124 void OnActionCompleted(bool success); |
| 125 void OnActionCompletedWithErrorCode(ErrorCode code); | 125 void OnActionCompletedWithErrorCode(ErrorCode code); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 136 base::Callback<void(void)> change_acked_callback_; | 136 base::Callback<void(void)> change_acked_callback_; |
| 137 | 137 |
| 138 ViewManagerDelegate* delegate_; | 138 ViewManagerDelegate* delegate_; |
| 139 | 139 |
| 140 std::vector<View*> roots_; | 140 std::vector<View*> roots_; |
| 141 | 141 |
| 142 IdToViewMap views_; | 142 IdToViewMap views_; |
| 143 | 143 |
| 144 ViewManagerService* service_; | 144 ViewManagerService* service_; |
| 145 | 145 |
| 146 WindowManagerService2Ptr window_manager_; | 146 WindowManagerPtr window_manager_; |
| 147 | 147 |
| 148 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); | 148 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 } // namespace mojo | 151 } // namespace mojo |
| 152 | 152 |
| 153 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 153 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
| OLD | NEW |