| 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/geometry/geometry_type_converters.h" | 12 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" |
| 13 #include "mojo/services/public/cpp/view_manager/types.h" | 13 #include "mojo/services/public/cpp/view_manager/types.h" |
| 14 #include "mojo/services/public/cpp/view_manager/view.h" | 14 #include "mojo/services/public/cpp/view_manager/view.h" |
| 15 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 15 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| 16 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 16 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
| 17 #include "mojo/services/public/interfaces/window_manager/window_manager.mojom.h" |
| 17 | 18 |
| 18 class SkBitmap; | 19 class SkBitmap; |
| 19 | 20 |
| 20 namespace mojo { | 21 namespace mojo { |
| 21 class ApplicationConnection; | 22 class ApplicationConnection; |
| 22 class ViewManager; | 23 class ViewManager; |
| 23 class ViewManagerDelegate; | 24 class ViewManagerDelegate; |
| 24 class ViewManagerTransaction; | 25 class ViewManagerTransaction; |
| 25 | 26 |
| 26 // Manages the connection with the View Manager service. | 27 // Manages the connection with the View Manager service. |
| 27 class ViewManagerClientImpl : public ViewManager, | 28 class ViewManagerClientImpl : public ViewManager, |
| 28 public InterfaceImpl<ViewManagerClient> { | 29 public InterfaceImpl<ViewManagerClient>, |
| 30 public WindowManagerClient { |
| 29 public: | 31 public: |
| 30 explicit ViewManagerClientImpl(ViewManagerDelegate* delegate); | 32 ViewManagerClientImpl(ViewManagerDelegate* delegate, |
| 33 ApplicationConnection* app_connection); |
| 31 virtual ~ViewManagerClientImpl(); | 34 virtual ~ViewManagerClientImpl(); |
| 32 | 35 |
| 33 bool connected() const { return connected_; } | 36 bool connected() const { return connected_; } |
| 34 ConnectionSpecificId connection_id() const { return connection_id_; } | 37 ConnectionSpecificId connection_id() const { return connection_id_; } |
| 35 | 38 |
| 36 // API exposed to the view implementations that pushes local changes to the | 39 // API exposed to the view implementations that pushes local changes to the |
| 37 // service. | 40 // service. |
| 38 Id CreateView(); | 41 Id CreateView(); |
| 39 void DestroyView(Id view_id); | 42 void DestroyView(Id view_id); |
| 40 | 43 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 Id new_parent_id, | 102 Id new_parent_id, |
| 100 Id old_parent_id, | 103 Id old_parent_id, |
| 101 Array<ViewDataPtr> views) OVERRIDE; | 104 Array<ViewDataPtr> views) OVERRIDE; |
| 102 virtual void OnViewReordered(Id view_id, | 105 virtual void OnViewReordered(Id view_id, |
| 103 Id relative_view_id, | 106 Id relative_view_id, |
| 104 OrderDirection direction) OVERRIDE; | 107 OrderDirection direction) OVERRIDE; |
| 105 virtual void OnViewDeleted(Id view_id) OVERRIDE; | 108 virtual void OnViewDeleted(Id view_id) OVERRIDE; |
| 106 virtual void OnViewInputEvent(Id view, | 109 virtual void OnViewInputEvent(Id view, |
| 107 EventPtr event, | 110 EventPtr event, |
| 108 const Callback<void()>& callback) OVERRIDE; | 111 const Callback<void()>& callback) OVERRIDE; |
| 109 virtual void OnFocusChanged(Id gained_focus_id, Id lost_focus_id) OVERRIDE; | |
| 110 virtual void Embed( | 112 virtual void Embed( |
| 111 const String& url, | 113 const String& url, |
| 112 InterfaceRequest<ServiceProvider> service_provider) OVERRIDE; | 114 InterfaceRequest<ServiceProvider> service_provider) OVERRIDE; |
| 113 virtual void DispatchOnViewInputEvent(Id view_id, EventPtr event) OVERRIDE; | 115 virtual void DispatchOnViewInputEvent(EventPtr event) OVERRIDE; |
| 116 |
| 117 // Overridden from WindowManagerClient: |
| 118 virtual void OnWindowManagerReady() OVERRIDE; |
| 119 virtual void OnCaptureChanged(Id old_capture_view_id, |
| 120 Id new_capture_view_id) OVERRIDE; |
| 121 virtual void OnFocusChanged(Id old_focused_view_id, |
| 122 Id new_focused_view_id) OVERRIDE; |
| 123 virtual void OnActiveWindowChanged(Id old_focused_window, |
| 124 Id new_focused_window) OVERRIDE; |
| 114 | 125 |
| 115 void RemoveRoot(View* root); | 126 void RemoveRoot(View* root); |
| 116 | 127 |
| 117 void OnActionCompleted(bool success); | 128 void OnActionCompleted(bool success); |
| 118 void OnActionCompletedWithErrorCode(ErrorCode code); | 129 void OnActionCompletedWithErrorCode(ErrorCode code); |
| 119 | 130 |
| 120 base::Callback<void(bool)> ActionCompletedCallback(); | 131 base::Callback<void(bool)> ActionCompletedCallback(); |
| 121 base::Callback<void(ErrorCode)> ActionCompletedCallbackWithErrorCode(); | 132 base::Callback<void(ErrorCode)> ActionCompletedCallbackWithErrorCode(); |
| 122 | 133 |
| 123 bool connected_; | 134 bool connected_; |
| 124 ConnectionSpecificId connection_id_; | 135 ConnectionSpecificId connection_id_; |
| 125 ConnectionSpecificId next_id_; | 136 ConnectionSpecificId next_id_; |
| 126 | 137 |
| 127 std::string creator_url_; | 138 std::string creator_url_; |
| 128 | 139 |
| 129 base::Callback<void(void)> change_acked_callback_; | 140 base::Callback<void(void)> change_acked_callback_; |
| 130 | 141 |
| 131 ViewManagerDelegate* delegate_; | 142 ViewManagerDelegate* delegate_; |
| 132 WindowManagerDelegate* window_manager_delegate_; | 143 WindowManagerDelegate* window_manager_delegate_; |
| 133 | 144 |
| 134 std::vector<View*> roots_; | 145 std::vector<View*> roots_; |
| 135 | 146 |
| 136 IdToViewMap views_; | 147 IdToViewMap views_; |
| 137 | 148 |
| 138 ViewManagerService* service_; | 149 ViewManagerService* service_; |
| 139 | 150 |
| 151 WindowManagerServicePtr window_manager_; |
| 152 |
| 140 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); | 153 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); |
| 141 }; | 154 }; |
| 142 | 155 |
| 143 } // namespace mojo | 156 } // namespace mojo |
| 144 | 157 |
| 145 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 158 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
| OLD | NEW |