| 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_MUS_H_ | 5 #ifndef UI_AURA_MUS_WINDOW_MUS_H_ |
| 6 #define UI_AURA_MUS_WINDOW_MUS_H_ | 6 #define UI_AURA_MUS_WINDOW_MUS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // WindowMus defines the interface used by WindowTreeClient to modify | 39 // WindowMus defines the interface used by WindowTreeClient to modify |
| 40 // the underlying Window. It's defined as a separate interface to make it clear | 40 // the underlying Window. It's defined as a separate interface to make it clear |
| 41 // that any changes that WindowTreeClient makes must be propagated through | 41 // that any changes that WindowTreeClient makes must be propagated through |
| 42 // this interface so that they don't result in bouncing back to | 42 // this interface so that they don't result in bouncing back to |
| 43 // WindowTreeClient. For example, if the server change the bounds care must be | 43 // WindowTreeClient. For example, if the server change the bounds care must be |
| 44 // taken that when the change is applied to the Window the server isn't asked to | 44 // taken that when the change is applied to the Window the server isn't asked to |
| 45 // change the bounds too. See WindowPortMus for details. | 45 // change the bounds too. See WindowPortMus for details. |
| 46 class AURA_EXPORT WindowMus { | 46 class AURA_EXPORT WindowMus { |
| 47 public: | 47 public: |
| 48 |
| 49 enum class ChangeSource { |
| 50 // The change was made locally. |
| 51 LOCAL, |
| 52 // The change originated from the server. |
| 53 SERVER, |
| 54 }; |
| 55 |
| 48 // |create_remote_window| indicates whether a window should be created on the | 56 // |create_remote_window| indicates whether a window should be created on the |
| 49 // server. Generally |create_remote_window| should be true, only in rare | 57 // server. Generally |create_remote_window| should be true, only in rare |
| 50 // exceptions (such as the root of a WindowTreeHost) is it false. | 58 // exceptions (such as the root of a WindowTreeHost) is it false. |
| 51 explicit WindowMus(bool create_remote_window) | 59 explicit WindowMus(bool create_remote_window) |
| 52 : create_remote_window_(create_remote_window) {} | 60 : create_remote_window_(create_remote_window) {} |
| 53 virtual ~WindowMus() {} | 61 virtual ~WindowMus() {} |
| 54 | 62 |
| 55 // Returns the WindowMus associated with |window|. | 63 // Returns the WindowMus associated with |window|. |
| 56 static WindowMus* Get(Window* window); | 64 static WindowMus* Get(Window* window); |
| 57 | 65 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 78 WindowMus* relative, | 86 WindowMus* relative, |
| 79 ui::mojom::OrderDirection) = 0; | 87 ui::mojom::OrderDirection) = 0; |
| 80 virtual void SetBoundsFromServer(const gfx::Rect& bounds) = 0; | 88 virtual void SetBoundsFromServer(const gfx::Rect& bounds) = 0; |
| 81 virtual void SetVisibleFromServer(bool visible) = 0; | 89 virtual void SetVisibleFromServer(bool visible) = 0; |
| 82 virtual void SetOpacityFromServer(float opacity) = 0; | 90 virtual void SetOpacityFromServer(float opacity) = 0; |
| 83 virtual void SetPredefinedCursorFromServer(ui::mojom::Cursor cursor) = 0; | 91 virtual void SetPredefinedCursorFromServer(ui::mojom::Cursor cursor) = 0; |
| 84 virtual void SetPropertyFromServer(const std::string& property_name, | 92 virtual void SetPropertyFromServer(const std::string& property_name, |
| 85 const std::vector<uint8_t>* data) = 0; | 93 const std::vector<uint8_t>* data) = 0; |
| 86 virtual void SetSurfaceIdFromServer( | 94 virtual void SetSurfaceIdFromServer( |
| 87 std::unique_ptr<SurfaceInfo> surface_info) = 0; | 95 std::unique_ptr<SurfaceInfo> surface_info) = 0; |
| 96 virtual void AddTransientChildFromServer(WindowMus* child) = 0; |
| 97 virtual void RemoveTransientChildFromServer(WindowMus* child) = 0; |
| 98 // Called when a window was added/removed as a transient child. |
| 99 virtual ChangeSource OnTransientChildAdded(WindowMus* child) = 0; |
| 100 virtual ChangeSource OnTransientChildRemoved(WindowMus* child) = 0; |
| 88 | 101 |
| 89 // Called in the rare case when WindowTreeClient needs to change state and | 102 // Called in the rare case when WindowTreeClient needs to change state and |
| 90 // can't go through one of the SetFooFromServer() functions above. Generally | 103 // can't go through one of the SetFooFromServer() functions above. Generally |
| 91 // because it needs to call another function that as a side effect changes the | 104 // because it needs to call another function that as a side effect changes the |
| 92 // window. Once the call to the underlying window has completed the returned | 105 // window. Once the call to the underlying window has completed the returned |
| 93 // object should be destroyed. | 106 // object should be destroyed. |
| 94 virtual std::unique_ptr<WindowMusChangeData> PrepareForServerBoundsChange( | 107 virtual std::unique_ptr<WindowMusChangeData> PrepareForServerBoundsChange( |
| 95 const gfx::Rect& bounds) = 0; | 108 const gfx::Rect& bounds) = 0; |
| 96 virtual std::unique_ptr<WindowMusChangeData> PrepareForServerVisibilityChange( | 109 virtual std::unique_ptr<WindowMusChangeData> PrepareForServerVisibilityChange( |
| 97 bool value) = 0; | 110 bool value) = 0; |
| 98 | 111 |
| 99 virtual void NotifyEmbeddedAppDisconnected() = 0; | 112 virtual void NotifyEmbeddedAppDisconnected() = 0; |
| 100 | 113 |
| 101 private: | 114 private: |
| 102 // Just for set_server_id(), which other places should not call. | 115 // Just for set_server_id(), which other places should not call. |
| 103 friend class WindowTreeClient; | 116 friend class WindowTreeClient; |
| 104 | 117 |
| 105 void set_server_id(Id id) { server_id_ = id; } | 118 void set_server_id(Id id) { server_id_ = id; } |
| 106 | 119 |
| 107 Id server_id_ = kInvalidServerId; | 120 Id server_id_ = kInvalidServerId; |
| 108 const bool create_remote_window_; | 121 const bool create_remote_window_; |
| 109 }; | 122 }; |
| 110 | 123 |
| 111 } // namespace aura | 124 } // namespace aura |
| 112 | 125 |
| 113 #endif // UI_AURA_MUS_WINDOW_MUS_H_ | 126 #endif // UI_AURA_MUS_WINDOW_MUS_H_ |
| OLD | NEW |