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