OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_PRIVATE_H_ | |
6 #define COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_PRIVATE_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <vector> | |
11 | |
12 #include "base/macros.h" | |
13 #include "components/mus/public/cpp/window.h" | |
14 #include "mojo/public/cpp/bindings/array.h" | |
15 | |
16 namespace mus { | |
17 | |
18 // This class is a friend of a Window and contains functions to mutate internal | |
19 // state of Window. | |
20 class WindowPrivate { | |
21 public: | |
22 explicit WindowPrivate(Window* window); | |
23 ~WindowPrivate(); | |
24 | |
25 // Creates and returns a new Window. Caller owns the return value. | |
26 static Window* LocalCreate(); | |
27 | |
28 base::ObserverList<WindowObserver>* observers() { | |
29 return &window_->observers_; | |
30 } | |
31 | |
32 void ClearParent() { window_->parent_ = nullptr; } | |
33 | |
34 void ClearTransientParent() { window_->transient_parent_ = nullptr; } | |
35 | |
36 void set_visible(bool visible) { window_->visible_ = visible; } | |
37 | |
38 void set_parent_drawn(bool drawn) { window_->parent_drawn_ = drawn; } | |
39 bool parent_drawn() { return window_->parent_drawn_; } | |
40 | |
41 void set_server_id(Id id) { window_->server_id_ = id; } | |
42 Id server_id() { return window_->server_id_; } | |
43 | |
44 void set_client(WindowTreeClient* client) { | |
45 window_->client_ = client; | |
46 } | |
47 | |
48 void set_properties(const std::map<std::string, std::vector<uint8_t>>& data) { | |
49 window_->properties_ = data; | |
50 } | |
51 | |
52 void LocalSetDisplay(int64_t new_display) { | |
53 window_->LocalSetDisplay(new_display); | |
54 } | |
55 | |
56 void LocalDestroy() { window_->LocalDestroy(); } | |
57 void LocalAddChild(Window* child) { window_->LocalAddChild(child); } | |
58 void LocalRemoveChild(Window* child) { window_->LocalRemoveChild(child); } | |
59 void LocalAddTransientWindow(Window* child) { | |
60 window_->LocalAddTransientWindow(child); | |
61 } | |
62 void LocalRemoveTransientWindow(Window* child) { | |
63 window_->LocalRemoveTransientWindow(child); | |
64 } | |
65 void LocalUnsetModal() { window_->is_modal_ = false; } | |
66 void LocalReorder(Window* relative, mojom::OrderDirection direction) { | |
67 window_->LocalReorder(relative, direction); | |
68 } | |
69 void LocalSetBounds(const gfx::Rect& old_bounds, | |
70 const gfx::Rect& new_bounds) { | |
71 window_->LocalSetBounds(old_bounds, new_bounds); | |
72 } | |
73 void LocalSetClientArea( | |
74 const gfx::Insets& client_area, | |
75 const std::vector<gfx::Rect>& additional_client_areas) { | |
76 window_->LocalSetClientArea(client_area, additional_client_areas); | |
77 } | |
78 void LocalSetParentDrawn(bool drawn) { window_->LocalSetParentDrawn(drawn); } | |
79 void LocalSetVisible(bool visible) { window_->LocalSetVisible(visible); } | |
80 void LocalSetOpacity(float opacity) { window_->LocalSetOpacity(opacity); } | |
81 void LocalSetPredefinedCursor(mojom::Cursor cursor) { | |
82 window_->LocalSetPredefinedCursor(cursor); | |
83 } | |
84 void LocalSetSharedProperty(const std::string& name, | |
85 mojo::Array<uint8_t> new_data); | |
86 void LocalSetSharedProperty(const std::string& name, | |
87 const std::vector<uint8_t>* data) { | |
88 window_->LocalSetSharedProperty(name, data); | |
89 } | |
90 void NotifyWindowStackingChanged() { window_->NotifyWindowStackingChanged(); } | |
91 | |
92 private: | |
93 Window* window_; | |
94 | |
95 DISALLOW_COPY_AND_ASSIGN(WindowPrivate); | |
96 }; | |
97 | |
98 } // namespace mus | |
99 | |
100 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_PRIVATE_H_ | |
OLD | NEW |