Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: services/ui/demo/mus_demo.h

Issue 2679213003: Refactor Mus demo to prepare support for multiple external windows (Closed)
Patch Set: Use a class instead of a struct to improve data separation. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | services/ui/demo/mus_demo.cc » ('j') | services/ui/demo/mus_demo.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 SERVICES_UI_DEMO_MUS_DEMO_H_ 5 #ifndef SERVICES_UI_DEMO_MUS_DEMO_H_
6 #define SERVICES_UI_DEMO_MUS_DEMO_H_ 6 #define SERVICES_UI_DEMO_MUS_DEMO_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 10 matching lines...) Expand all
21 21
22 namespace aura { 22 namespace aura {
23 class Env; 23 class Env;
24 class PropertyConverter; 24 class PropertyConverter;
25 25
26 namespace client { 26 namespace client {
27 class DefaultCaptureClient; 27 class DefaultCaptureClient;
28 } 28 }
29 } // namespace aura 29 } // namespace aura
30 30
31 namespace aura_extra {
32 class ImageWindowDelegate;
33 }
34
35 namespace wm { 31 namespace wm {
36 class WMState; 32 class WMState;
37 } 33 }
38 34
39 namespace ui { 35 namespace ui {
40 namespace demo { 36 namespace demo {
41 37
42 // A simple MUS Demo service. This service connects to the service:ui, adds a 38 // A simple MUS Demo service. This service connects to the service:ui, adds a
43 // new window to the root Window, and draws a spinning square in the center of 39 // new window to the root Window, and draws a spinning square in the center of
44 // the window. Provides a simple way to demonstrate that the graphic stack works 40 // the window. Provides a simple way to demonstrate that the graphic stack works
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 const gfx::Point& cursor_location, 87 const gfx::Point& cursor_location,
92 const base::Callback<void(bool)>& on_done) override; 88 const base::Callback<void(bool)>& on_done) override;
93 void OnWmCancelMoveLoop(aura::Window* window) override; 89 void OnWmCancelMoveLoop(aura::Window* window) override;
94 void OnWmSetClientArea( 90 void OnWmSetClientArea(
95 aura::Window* window, 91 aura::Window* window,
96 const gfx::Insets& insets, 92 const gfx::Insets& insets,
97 const std::vector<gfx::Rect>& additional_client_areas) override; 93 const std::vector<gfx::Rect>& additional_client_areas) override;
98 bool IsWindowActive(aura::Window* window) override; 94 bool IsWindowActive(aura::Window* window) override;
99 void OnWmDeactivateWindow(aura::Window* window) override; 95 void OnWmDeactivateWindow(aura::Window* window) override;
100 96
101 // Draws one frame, incrementing the rotation angle.
102 void DrawFrame();
103
104 aura::Window* root_window_ = nullptr;
105 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; 97 std::unique_ptr<aura::WindowTreeClient> window_tree_client_;
106 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_;
107 std::unique_ptr<aura::Env> env_; 98 std::unique_ptr<aura::Env> env_;
108 std::unique_ptr<display::ScreenBase> screen_; 99 std::unique_ptr<display::ScreenBase> screen_;
109 100
110 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; 101 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_;
111 std::unique_ptr<::wm::WMState> wm_state_; 102 std::unique_ptr<::wm::WMState> wm_state_;
112 std::unique_ptr<aura::PropertyConverter> property_converter_; 103 std::unique_ptr<aura::PropertyConverter> property_converter_;
113 104
114 // Window to which we draw the bitmap. 105 class WindowTreeData;
115 std::unique_ptr<aura::Window> bitmap_window_; 106 std::unique_ptr<WindowTreeData> window_tree_data_;
116
117 // Destroys itself when the window gets destroyed.
118 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr;
119
120 // Timer for calling DrawFrame().
121 base::RepeatingTimer timer_;
122
123 // Current rotation angle for drawing.
124 double angle_ = 0.0;
125
126 // Last time a frame was drawn.
127 base::TimeTicks last_draw_frame_time_;
128 107
129 DISALLOW_COPY_AND_ASSIGN(MusDemo); 108 DISALLOW_COPY_AND_ASSIGN(MusDemo);
130 }; 109 };
131 110
132 } // namespace demo 111 } // namespace demo
133 } // namespace aura 112 } // namespace aura
134 113
135 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ 114 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/demo/mus_demo.cc » ('j') | services/ui/demo/mus_demo.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698