OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_AURA_MUS_WINDOW_MUS_H_ |
| 6 #define UI_AURA_MUS_WINDOW_MUS_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <string> |
| 11 #include <vector> |
| 12 |
| 13 #include "services/ui/public/interfaces/cursor.mojom.h" |
| 14 #include "ui/aura/aura_export.h" |
| 15 #include "ui/aura/mus/mus_types.h" |
| 16 |
| 17 namespace gfx { |
| 18 class Rect; |
| 19 } |
| 20 |
| 21 namespace ui { |
| 22 namespace mojom { |
| 23 enum class OrderDirection; |
| 24 } |
| 25 } |
| 26 |
| 27 namespace aura { |
| 28 |
| 29 struct SurfaceInfo; |
| 30 class Window; |
| 31 class WindowTreeClient; |
| 32 |
| 33 // WindowMus defines the interface used by WindowTreeClient to modify |
| 34 // the underlying Window. It's defined as a separate interface to make it clear |
| 35 // that any changes that WindowTreeClient makes must be propagated through |
| 36 // this interface so that they don't result in bouncing back to |
| 37 // WindowTreeClient. For example, if the server change the bounds care must be |
| 38 // taken that when the change is applied to the Window the server isn't asked to |
| 39 // change the bounds too. See WindowPortMus for details. |
| 40 class AURA_EXPORT WindowMus { |
| 41 public: |
| 42 virtual ~WindowMus() {} |
| 43 |
| 44 // Returns the WindowMus associated with |window|. |
| 45 static WindowMus* Get(Window* window); |
| 46 |
| 47 Id server_id() const { return server_id_; } |
| 48 |
| 49 // Top level windows may have a root window with no associated server window. |
| 50 // This happens because the client creates the top level window first, and |
| 51 // then the WindowTreeHost. Each WindowTreeHost has a Window, so the |
| 52 // WindowTreeHost for top-levels has no server window. |
| 53 bool has_server_window() const { return server_id() != kInvalidServerId; } |
| 54 |
| 55 virtual Window* GetWindow() = 0; |
| 56 |
| 57 // These functions are called in response to a change from the server. The |
| 58 // expectation is that in calling these WindowTreeClient is not called |
| 59 // back. For example, SetBoundsFromServer() should not result in calling back |
| 60 // to WindowTreeClient::OnWindowMusBoundsChanged(). |
| 61 virtual void AddChildFromServer(WindowMus* window) = 0; |
| 62 virtual void RemoveChildFromServer(WindowMus* child) = 0; |
| 63 virtual void ReorderFromServer(WindowMus* child, |
| 64 WindowMus* relative, |
| 65 ui::mojom::OrderDirection) = 0; |
| 66 virtual void SetBoundsFromServer(const gfx::Rect& bounds) = 0; |
| 67 virtual void SetVisibleFromServer(bool visible) = 0; |
| 68 virtual void SetOpacityFromServer(float opacity) = 0; |
| 69 virtual void SetPredefinedCursorFromServer(ui::mojom::Cursor cursor) = 0; |
| 70 virtual void SetPropertyFromServer(const std::string& property_name, |
| 71 const std::vector<uint8_t>* data) = 0; |
| 72 virtual void SetSurfaceIdFromServer( |
| 73 std::unique_ptr<SurfaceInfo> surface_info) = 0; |
| 74 |
| 75 virtual void NotifyEmbeddedAppDisconnected() = 0; |
| 76 |
| 77 private: |
| 78 // Just for set_server_id(), which other places should not call. |
| 79 friend class WindowTreeClient; |
| 80 |
| 81 void set_server_id(Id id) { server_id_ = id; } |
| 82 |
| 83 Id server_id_ = kInvalidServerId; |
| 84 }; |
| 85 |
| 86 } // namespace aura |
| 87 |
| 88 #endif // UI_AURA_MUS_WINDOW_MUS_H_ |
OLD | NEW |