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> |
(...skipping 17 matching lines...) Expand all Loading... |
28 // simple way to demonstrate that the graphic stack works as intended. | 28 // simple way to demonstrate that the graphic stack works as intended. |
29 class MusDemo : public shell::Service, | 29 class MusDemo : public shell::Service, |
30 public WindowTreeClientDelegate, | 30 public WindowTreeClientDelegate, |
31 public WindowManagerDelegate { | 31 public WindowManagerDelegate { |
32 public: | 32 public: |
33 MusDemo(); | 33 MusDemo(); |
34 ~MusDemo() override; | 34 ~MusDemo() override; |
35 | 35 |
36 private: | 36 private: |
37 // shell::Service: | 37 // shell::Service: |
38 void OnStart(shell::Connector* connector, | 38 void OnStart(const shell::Identity& identity) override; |
39 const shell::Identity& identity, | |
40 uint32_t id) override; | |
41 bool OnConnect(shell::Connection* connection) override; | 39 bool OnConnect(shell::Connection* connection) override; |
42 | 40 |
43 // WindowTreeClientDelegate: | 41 // WindowTreeClientDelegate: |
44 void OnEmbed(Window* root) override; | 42 void OnEmbed(Window* root) override; |
45 void OnDidDestroyClient(WindowTreeClient* client) override; | 43 void OnDidDestroyClient(WindowTreeClient* client) override; |
46 void OnEventObserved(const Event& event, Window* target) override; | 44 void OnEventObserved(const Event& event, Window* target) override; |
47 | 45 |
48 // WindowManagerDelegate: | 46 // WindowManagerDelegate: |
49 void SetWindowManagerClient(WindowManagerClient* client) override; | 47 void SetWindowManagerClient(WindowManagerClient* client) override; |
50 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override; | 48 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override; |
(...skipping 11 matching lines...) Expand all Loading... |
62 const gfx::Point& cursor_location, | 60 const gfx::Point& cursor_location, |
63 const base::Callback<void(bool)>& on_done) override; | 61 const base::Callback<void(bool)>& on_done) override; |
64 void OnWmCancelMoveLoop(Window* window) override; | 62 void OnWmCancelMoveLoop(Window* window) override; |
65 | 63 |
66 // Allocate a bitmap the same size as the window to draw into. | 64 // Allocate a bitmap the same size as the window to draw into. |
67 void AllocBitmap(); | 65 void AllocBitmap(); |
68 | 66 |
69 // Draws one frame, incrementing the rotation angle. | 67 // Draws one frame, incrementing the rotation angle. |
70 void DrawFrame(); | 68 void DrawFrame(); |
71 | 69 |
72 shell::Connector* connector_ = nullptr; | |
73 | |
74 Window* window_ = nullptr; | 70 Window* window_ = nullptr; |
75 WindowTreeClient* window_tree_client_ = nullptr; | 71 WindowTreeClient* window_tree_client_ = nullptr; |
76 | 72 |
77 // Used to send frames to mus. | 73 // Used to send frames to mus. |
78 std::unique_ptr<ui::BitmapUploader> uploader_; | 74 std::unique_ptr<ui::BitmapUploader> uploader_; |
79 | 75 |
80 // Bitmap that is the same size as our client window area. | 76 // Bitmap that is the same size as our client window area. |
81 SkBitmap bitmap_; | 77 SkBitmap bitmap_; |
82 | 78 |
83 // Timer for calling DrawFrame(). | 79 // Timer for calling DrawFrame(). |
84 base::RepeatingTimer timer_; | 80 base::RepeatingTimer timer_; |
85 | 81 |
86 // Current rotation angle for drawing. | 82 // Current rotation angle for drawing. |
87 double angle_ = 0.0; | 83 double angle_ = 0.0; |
88 | 84 |
89 DISALLOW_COPY_AND_ASSIGN(MusDemo); | 85 DISALLOW_COPY_AND_ASSIGN(MusDemo); |
90 }; | 86 }; |
91 | 87 |
92 } // namespace demo | 88 } // namespace demo |
93 } // namespace ui | 89 } // namespace ui |
94 | 90 |
95 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ | 91 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ |
OLD | NEW |