OLD | NEW |
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> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "services/shell/public/cpp/service.h" | 17 #include "services/shell/public/cpp/service.h" |
18 #include "services/ui/public/cpp/window_manager_delegate.h" | 18 #include "services/ui/public/cpp/window_manager_delegate.h" |
19 #include "services/ui/public/cpp/window_tree_client_delegate.h" | 19 #include "services/ui/public/cpp/window_tree_client_delegate.h" |
20 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
21 | 21 |
22 namespace bitmap_uploader { | 22 namespace ui { |
23 class BitmapUploader; | 23 class BitmapUploader; |
24 } | |
25 | |
26 namespace ui { | |
27 namespace demo { | 24 namespace demo { |
28 | 25 |
29 // A simple MUS Demo mojo app. This app connects to the mojo:ui, creates a new | 26 // A simple MUS Demo mojo app. This app connects to the mojo:ui, creates a new |
30 // window and draws a spinning square in the center of the window. Provides a | 27 // window and draws a spinning square in the center of the window. Provides a |
31 // simple way to demonstrate that the graphic stack works as intended. | 28 // simple way to demonstrate that the graphic stack works as intended. |
32 class MusDemo : public shell::Service, | 29 class MusDemo : public shell::Service, |
33 public WindowTreeClientDelegate, | 30 public WindowTreeClientDelegate, |
34 public WindowManagerDelegate { | 31 public WindowManagerDelegate { |
35 public: | 32 public: |
36 MusDemo(); | 33 MusDemo(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 68 |
72 // Draws one frame, incrementing the rotation angle. | 69 // Draws one frame, incrementing the rotation angle. |
73 void DrawFrame(); | 70 void DrawFrame(); |
74 | 71 |
75 shell::Connector* connector_ = nullptr; | 72 shell::Connector* connector_ = nullptr; |
76 | 73 |
77 Window* window_ = nullptr; | 74 Window* window_ = nullptr; |
78 WindowTreeClient* window_tree_client_ = nullptr; | 75 WindowTreeClient* window_tree_client_ = nullptr; |
79 | 76 |
80 // Used to send frames to mus. | 77 // Used to send frames to mus. |
81 std::unique_ptr<bitmap_uploader::BitmapUploader> uploader_; | 78 std::unique_ptr<ui::BitmapUploader> uploader_; |
82 | 79 |
83 // Bitmap that is the same size as our client window area. | 80 // Bitmap that is the same size as our client window area. |
84 SkBitmap bitmap_; | 81 SkBitmap bitmap_; |
85 | 82 |
86 // Timer for calling DrawFrame(). | 83 // Timer for calling DrawFrame(). |
87 base::RepeatingTimer timer_; | 84 base::RepeatingTimer timer_; |
88 | 85 |
89 // Current rotation angle for drawing. | 86 // Current rotation angle for drawing. |
90 double angle_ = 0.0; | 87 double angle_ = 0.0; |
91 | 88 |
92 DISALLOW_COPY_AND_ASSIGN(MusDemo); | 89 DISALLOW_COPY_AND_ASSIGN(MusDemo); |
93 }; | 90 }; |
94 | 91 |
95 } // namespace demo | 92 } // namespace demo |
96 } // namespace ui | 93 } // namespace ui |
97 | 94 |
98 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ | 95 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ |
OLD | NEW |