| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 UI_AURA_MUS_WINDOW_PORT_MUS_H_ | 5 #ifndef UI_AURA_MUS_WINDOW_PORT_MUS_H_ |
| 6 #define UI_AURA_MUS_WINDOW_PORT_MUS_H_ | 6 #define UI_AURA_MUS_WINDOW_PORT_MUS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class WindowTreeClient; | 29 class WindowTreeClient; |
| 30 class WindowTreeClientPrivate; | 30 class WindowTreeClientPrivate; |
| 31 | 31 |
| 32 // WindowPortMus is a WindowPort that forwards calls to WindowTreeClient | 32 // WindowPortMus is a WindowPort that forwards calls to WindowTreeClient |
| 33 // so that changes are propagated to the server. All changes from | 33 // so that changes are propagated to the server. All changes from |
| 34 // WindowTreeClient to the underlying Window route through this class (by | 34 // WindowTreeClient to the underlying Window route through this class (by |
| 35 // way of WindowMus) and are done in such a way that they don't result in | 35 // way of WindowMus) and are done in such a way that they don't result in |
| 36 // calling back to WindowTreeClient. | 36 // calling back to WindowTreeClient. |
| 37 class AURA_EXPORT WindowPortMus : public WindowPort, public WindowMus { | 37 class AURA_EXPORT WindowPortMus : public WindowPort, public WindowMus { |
| 38 public: | 38 public: |
| 39 WindowPortMus(WindowTreeClient* client); | 39 // See WindowMus's constructor for details on |create_remote_window|. |
| 40 explicit WindowPortMus(WindowTreeClient* client, |
| 41 bool create_remote_window = true); |
| 40 ~WindowPortMus() override; | 42 ~WindowPortMus() override; |
| 41 | 43 |
| 42 static WindowPortMus* Get(Window* window); | 44 static WindowPortMus* Get(Window* window); |
| 43 | 45 |
| 44 Window* window() { return window_; } | 46 Window* window() { return window_; } |
| 45 const Window* window() const { return window_; } | 47 const Window* window() const { return window_; } |
| 46 | 48 |
| 47 void SetTextInputState(mojo::TextInputStatePtr state); | 49 void SetTextInputState(mojo::TextInputStatePtr state); |
| 48 void SetImeVisibility(bool visible, mojo::TextInputStatePtr state); | 50 void SetImeVisibility(bool visible, mojo::TextInputStatePtr state); |
| 49 | 51 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 132 |
| 131 ~ScopedServerChange() { window_impl_->RemoveChangeById(server_change_id_); } | 133 ~ScopedServerChange() { window_impl_->RemoveChangeById(server_change_id_); } |
| 132 | 134 |
| 133 private: | 135 private: |
| 134 WindowPortMus* window_impl_; | 136 WindowPortMus* window_impl_; |
| 135 const ServerChangeIdType server_change_id_; | 137 const ServerChangeIdType server_change_id_; |
| 136 | 138 |
| 137 DISALLOW_COPY_AND_ASSIGN(ScopedServerChange); | 139 DISALLOW_COPY_AND_ASSIGN(ScopedServerChange); |
| 138 }; | 140 }; |
| 139 | 141 |
| 142 struct WindowMusChangeDataImpl : public WindowMusChangeData { |
| 143 WindowMusChangeDataImpl(); |
| 144 ~WindowMusChangeDataImpl() override; |
| 145 |
| 146 std::unique_ptr<ScopedServerChange> change; |
| 147 }; |
| 148 |
| 140 // Creates and adds a ServerChange to |server_changes_|. Returns the id | 149 // Creates and adds a ServerChange to |server_changes_|. Returns the id |
| 141 // assigned to the ServerChange. | 150 // assigned to the ServerChange. |
| 142 ServerChangeIdType ScheduleChange(const ServerChangeType type, | 151 ServerChangeIdType ScheduleChange(const ServerChangeType type, |
| 143 const ServerChangeData& data); | 152 const ServerChangeData& data); |
| 144 | 153 |
| 145 // Removes a ServerChange by id. | 154 // Removes a ServerChange by id. |
| 146 void RemoveChangeById(ServerChangeIdType change_id); | 155 void RemoveChangeById(ServerChangeIdType change_id); |
| 147 | 156 |
| 148 // If there is a schedule change matching |type| and |data| it is removed and | 157 // If there is a schedule change matching |type| and |data| it is removed and |
| 149 // true is returned. If no matching change is scheduled returns false. | 158 // true is returned. If no matching change is scheduled returns false. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 161 ui::mojom::OrderDirection) override; | 170 ui::mojom::OrderDirection) override; |
| 162 void SetBoundsFromServer(const gfx::Rect& bounds) override; | 171 void SetBoundsFromServer(const gfx::Rect& bounds) override; |
| 163 void SetVisibleFromServer(bool visible) override; | 172 void SetVisibleFromServer(bool visible) override; |
| 164 void SetOpacityFromServer(float opacity) override; | 173 void SetOpacityFromServer(float opacity) override; |
| 165 void SetPredefinedCursorFromServer(ui::mojom::Cursor cursor) override; | 174 void SetPredefinedCursorFromServer(ui::mojom::Cursor cursor) override; |
| 166 void SetPropertyFromServer( | 175 void SetPropertyFromServer( |
| 167 const std::string& property_name, | 176 const std::string& property_name, |
| 168 const std::vector<uint8_t>* property_data) override; | 177 const std::vector<uint8_t>* property_data) override; |
| 169 void SetSurfaceIdFromServer( | 178 void SetSurfaceIdFromServer( |
| 170 std::unique_ptr<SurfaceInfo> surface_info) override; | 179 std::unique_ptr<SurfaceInfo> surface_info) override; |
| 180 std::unique_ptr<WindowMusChangeData> PrepareForServerBoundsChange( |
| 181 const gfx::Rect& bounds) override; |
| 182 std::unique_ptr<WindowMusChangeData> PrepareForServerVisibilityChange( |
| 183 bool value) override; |
| 171 void NotifyEmbeddedAppDisconnected() override; | 184 void NotifyEmbeddedAppDisconnected() override; |
| 172 | 185 |
| 173 // WindowPort: | 186 // WindowPort: |
| 174 std::unique_ptr<WindowPortInitData> OnPreInit(Window* window) override; | 187 std::unique_ptr<WindowPortInitData> OnPreInit(Window* window) override; |
| 175 void OnPostInit(std::unique_ptr<WindowPortInitData> init_data) override; | 188 void OnPostInit(std::unique_ptr<WindowPortInitData> init_data) override; |
| 176 void OnDeviceScaleFactorChanged(float device_scale_factor) override; | 189 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
| 177 void OnWillAddChild(Window* child) override; | 190 void OnWillAddChild(Window* child) override; |
| 178 void OnWillRemoveChild(Window* child) override; | 191 void OnWillRemoveChild(Window* child) override; |
| 179 void OnWillMoveChild(size_t current_index, size_t dest_index) override; | 192 void OnWillMoveChild(size_t current_index, size_t dest_index) override; |
| 180 void OnVisibilityChanged(bool visible) override; | 193 void OnVisibilityChanged(bool visible) override; |
| 181 void OnDidChangeBounds(const gfx::Rect& old_bounds, | 194 void OnDidChangeBounds(const gfx::Rect& old_bounds, |
| 182 const gfx::Rect& new_bounds) override; | 195 const gfx::Rect& new_bounds) override; |
| 183 std::unique_ptr<WindowPortPropertyData> OnWillChangeProperty( | 196 std::unique_ptr<WindowPortPropertyData> OnWillChangeProperty( |
| 184 const void* key) override; | 197 const void* key) override; |
| 185 void OnPropertyChanged(const void* key, | 198 void OnPropertyChanged(const void* key, |
| 186 std::unique_ptr<WindowPortPropertyData> data) override; | 199 std::unique_ptr<WindowPortPropertyData> data) override; |
| 187 | 200 |
| 188 WindowTreeClient* window_tree_client_; | 201 WindowTreeClient* window_tree_client_; |
| 202 |
| 189 Window* window_ = nullptr; | 203 Window* window_ = nullptr; |
| 190 | 204 |
| 191 ServerChangeIdType next_server_change_id_ = 0; | 205 ServerChangeIdType next_server_change_id_ = 0; |
| 192 std::vector<ServerChange> server_changes_; | 206 std::vector<ServerChange> server_changes_; |
| 193 | 207 |
| 194 SurfaceIdHandler* surface_id_handler_; | 208 SurfaceIdHandler* surface_id_handler_; |
| 195 std::unique_ptr<SurfaceInfo> surface_info_; | 209 std::unique_ptr<SurfaceInfo> surface_info_; |
| 196 | 210 |
| 197 ui::mojom::Cursor predefined_cursor_ = ui::mojom::Cursor::CURSOR_NULL; | 211 ui::mojom::Cursor predefined_cursor_ = ui::mojom::Cursor::CURSOR_NULL; |
| 198 | 212 |
| 199 DISALLOW_COPY_AND_ASSIGN(WindowPortMus); | 213 DISALLOW_COPY_AND_ASSIGN(WindowPortMus); |
| 200 }; | 214 }; |
| 201 | 215 |
| 202 } // namespace aura | 216 } // namespace aura |
| 203 | 217 |
| 204 #endif // UI_AURA_MUS_WINDOW_PORT_MUS_H_ | 218 #endif // UI_AURA_MUS_WINDOW_PORT_MUS_H_ |
| OLD | NEW |