| 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_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
| 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_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" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "mojo/public/cpp/bindings/strong_binding.h" | 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 13 #include "mojo/services/public/cpp/view_manager/types.h" | 13 #include "mojo/services/view_manager/public/cpp/types.h" |
| 14 #include "mojo/services/public/cpp/view_manager/view.h" | 14 #include "mojo/services/view_manager/public/cpp/view.h" |
| 15 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 15 #include "mojo/services/view_manager/public/cpp/view_manager.h" |
| 16 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 16 #include "mojo/services/view_manager/public/interfaces/view_manager.mojom.h" |
| 17 #include "mojo/services/public/interfaces/window_manager/window_manager.mojom.h" | 17 #include "mojo/services/window_manager/public/interfaces/window_manager.mojom.h" |
| 18 | 18 |
| 19 namespace mojo { | 19 namespace mojo { |
| 20 class Shell; | 20 class Shell; |
| 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 ViewManagerClient, | 27 public ViewManagerClient, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void AddView(View* view); | 78 void AddView(View* view); |
| 79 void RemoveView(Id view_id); | 79 void RemoveView(Id view_id); |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 friend class RootObserver; | 82 friend class RootObserver; |
| 83 | 83 |
| 84 typedef std::map<Id, View*> IdToViewMap; | 84 typedef std::map<Id, View*> IdToViewMap; |
| 85 | 85 |
| 86 // Overridden from ViewManager: | 86 // Overridden from ViewManager: |
| 87 const std::string& GetEmbedderURL() const override; | 87 const std::string& GetEmbedderURL() const override; |
| 88 const std::vector<View*>& GetRoots() const override; | 88 View* GetRoot() override; |
| 89 View* GetViewById(Id id) override; | 89 View* GetViewById(Id id) override; |
| 90 View* GetFocusedView() override; |
| 90 | 91 |
| 91 // Overridden from ViewManagerClient: | 92 // Overridden from ViewManagerClient: |
| 92 void OnEmbed(ConnectionSpecificId connection_id, | 93 void OnEmbed(ConnectionSpecificId connection_id, |
| 93 const String& creator_url, | 94 const String& creator_url, |
| 94 ViewDataPtr root, | 95 ViewDataPtr root, |
| 95 InterfaceRequest<ServiceProvider> parent_services, | 96 InterfaceRequest<ServiceProvider> parent_services, |
| 96 ScopedMessagePipeHandle window_manager_pipe) override; | 97 ScopedMessagePipeHandle window_manager_pipe) override; |
| 97 void OnEmbeddedAppDisconnected(Id view_id) override; | 98 void OnEmbeddedAppDisconnected(Id view_id) override; |
| 98 void OnViewBoundsChanged(Id view_id, | 99 void OnViewBoundsChanged(Id view_id, |
| 99 RectPtr old_bounds, | 100 RectPtr old_bounds, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 118 // Overridden from WindowManagerClient: | 119 // Overridden from WindowManagerClient: |
| 119 void OnCaptureChanged(Id old_capture_view_id, | 120 void OnCaptureChanged(Id old_capture_view_id, |
| 120 Id new_capture_view_id) override; | 121 Id new_capture_view_id) override; |
| 121 void OnFocusChanged(Id old_focused_view_id, Id new_focused_view_id) override; | 122 void OnFocusChanged(Id old_focused_view_id, Id new_focused_view_id) override; |
| 122 void OnActiveWindowChanged(Id old_focused_window, | 123 void OnActiveWindowChanged(Id old_focused_window, |
| 123 Id new_focused_window) override; | 124 Id new_focused_window) override; |
| 124 | 125 |
| 125 // ErrorHandler implementation. | 126 // ErrorHandler implementation. |
| 126 void OnConnectionError() override; | 127 void OnConnectionError() override; |
| 127 | 128 |
| 128 void RemoveRoot(View* root); | 129 void RootDestroyed(View* root); |
| 129 | 130 |
| 130 void OnActionCompleted(bool success); | 131 void OnActionCompleted(bool success); |
| 131 void OnActionCompletedWithErrorCode(ErrorCode code); | 132 void OnActionCompletedWithErrorCode(ErrorCode code); |
| 132 | 133 |
| 133 base::Callback<void(bool)> ActionCompletedCallback(); | 134 base::Callback<void(bool)> ActionCompletedCallback(); |
| 134 base::Callback<void(ErrorCode)> ActionCompletedCallbackWithErrorCode(); | 135 base::Callback<void(ErrorCode)> ActionCompletedCallbackWithErrorCode(); |
| 135 | 136 |
| 137 // Callback from server for initial request of focused/active views. |
| 138 void OnGotFocusedAndActiveViews(uint32 focused_view_id, |
| 139 uint32 active_view_id); |
| 140 |
| 136 bool connected_; | 141 bool connected_; |
| 137 ConnectionSpecificId connection_id_; | 142 ConnectionSpecificId connection_id_; |
| 138 ConnectionSpecificId next_id_; | 143 ConnectionSpecificId next_id_; |
| 139 | 144 |
| 140 std::string creator_url_; | 145 std::string creator_url_; |
| 141 | 146 |
| 142 base::Callback<void(void)> change_acked_callback_; | 147 base::Callback<void(void)> change_acked_callback_; |
| 143 | 148 |
| 144 ViewManagerDelegate* delegate_; | 149 ViewManagerDelegate* delegate_; |
| 145 | 150 |
| 146 std::vector<View*> roots_; | 151 View* root_; |
| 147 | 152 |
| 148 IdToViewMap views_; | 153 IdToViewMap views_; |
| 149 | 154 |
| 155 View* focused_view_; |
| 156 |
| 150 WindowManagerPtr window_manager_; | 157 WindowManagerPtr window_manager_; |
| 151 | 158 |
| 152 Binding<ViewManagerClient> binding_; | 159 Binding<ViewManagerClient> binding_; |
| 153 ViewManagerService* service_; | 160 ViewManagerService* service_; |
| 154 const bool delete_on_error_; | 161 const bool delete_on_error_; |
| 155 | 162 |
| 156 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); | 163 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); |
| 157 }; | 164 }; |
| 158 | 165 |
| 159 } // namespace mojo | 166 } // namespace mojo |
| 160 | 167 |
| 161 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 168 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
| OLD | NEW |