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

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

Issue 2694843005: Mus Demo: Move definition of WindowTreeData into separate files. (Closed)
Patch Set: 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') | no next file with comments »
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 } // namespace aura_extra
34
31 namespace wm { 35 namespace wm {
32 class WMState; 36 class WMState;
33 } 37 }
34 38
35 namespace ui { 39 namespace ui {
36 namespace demo { 40 namespace demo {
37 41
38 // A simple MUS Demo service. This service connects to the service:ui, adds a 42 // A simple MUS Demo service. This service connects to the service:ui, adds a
39 // new window to the root Window, and draws a spinning square in the center of 43 // new window to the root Window, and draws a spinning square in the center of
40 // the window. Provides a simple way to demonstrate that the graphic stack works 44 // the window. Provides a simple way to demonstrate that the graphic stack works
41 // as intended. 45 // as intended.
42 class MusDemo : public service_manager::Service, 46 class MusDemo : public service_manager::Service,
43 public aura::WindowTreeClientDelegate, 47 public aura::WindowTreeClientDelegate,
44 public aura::WindowManagerDelegate { 48 public aura::WindowManagerDelegate {
45 public: 49 public:
46 MusDemo(); 50 MusDemo();
47 ~MusDemo() override; 51 ~MusDemo() override;
48 52
53 protected:
54 class WindowTreeData {
kylechar 2017/02/14 16:58:10 This is a pretty big class. Is there any reason it
fwang 2017/02/14 17:20:26 I guess so. I was not sure either :-)
fwang 2017/02/15 13:45:06 Done.
55 public:
56 explicit WindowTreeData(
57 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host,
58 int square_size);
59 ~WindowTreeData();
60
61 private:
62 // Initializes the window tree host and start drawing frames.
63 void Init(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host);
64
65 // Draws one frame, incrementing the rotation angle.
66 void DrawFrame();
67
68 // Helper function to retrieve the window to which we draw the bitmap.
69 aura::Window* bitmap_window();
70
71 // The Window tree host corresponding to this data.
72 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_;
73
74 // Destroys itself when the window gets destroyed.
75 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr;
76
77 // Timer for calling DrawFrame().
78 base::RepeatingTimer timer_;
79
80 // Current rotation angle for drawing.
81 double angle_ = 0.0;
82
83 // Size in pixels of the square to draw.
84 const int square_size_;
85
86 DISALLOW_COPY_AND_ASSIGN(WindowTreeData);
87 };
88 std::unique_ptr<WindowTreeData> window_tree_data_;
kylechar 2017/02/14 16:58:10 Move to private section.
fwang 2017/02/14 17:20:26 Yes, this will be needed later (see https://codere
kylechar 2017/02/14 18:27:00 It should be in the private section regardless. If
fwang 2017/02/15 13:45:06 Done.
89
49 private: 90 private:
50 // service_manager::Service: 91 // service_manager::Service:
51 void OnStart() override; 92 void OnStart() override;
52 bool OnConnect(const service_manager::ServiceInfo& remote_info, 93 bool OnConnect(const service_manager::ServiceInfo& remote_info,
53 service_manager::InterfaceRegistry* registry) override; 94 service_manager::InterfaceRegistry* registry) override;
54 95
55 // aura::WindowTreeClientDelegate: 96 // aura::WindowTreeClientDelegate:
56 void OnEmbed( 97 void OnEmbed(
57 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override; 98 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override;
58 void OnUnembed(aura::Window* root) override; 99 void OnUnembed(aura::Window* root) override;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void OnWmDeactivateWindow(aura::Window* window) override; 136 void OnWmDeactivateWindow(aura::Window* window) override;
96 137
97 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; 138 std::unique_ptr<aura::WindowTreeClient> window_tree_client_;
98 std::unique_ptr<aura::Env> env_; 139 std::unique_ptr<aura::Env> env_;
99 std::unique_ptr<display::ScreenBase> screen_; 140 std::unique_ptr<display::ScreenBase> screen_;
100 141
101 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; 142 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_;
102 std::unique_ptr<::wm::WMState> wm_state_; 143 std::unique_ptr<::wm::WMState> wm_state_;
103 std::unique_ptr<aura::PropertyConverter> property_converter_; 144 std::unique_ptr<aura::PropertyConverter> property_converter_;
104 145
105 class WindowTreeData;
106 std::unique_ptr<WindowTreeData> window_tree_data_;
107
108 DISALLOW_COPY_AND_ASSIGN(MusDemo); 146 DISALLOW_COPY_AND_ASSIGN(MusDemo);
109 }; 147 };
110 148
111 } // namespace demo 149 } // namespace demo
112 } // namespace aura 150 } // namespace aura
113 151
114 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ 152 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/demo/mus_demo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698