| 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 25 matching lines...) Expand all Loading... |
| 36 ~MusDemo() override; | 36 ~MusDemo() override; |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // shell::Service: | 39 // shell::Service: |
| 40 void OnStart(const shell::Identity& identity) override; | 40 void OnStart(const shell::Identity& identity) override; |
| 41 bool OnConnect(const shell::Identity& remote_identity, | 41 bool OnConnect(const shell::Identity& remote_identity, |
| 42 shell::InterfaceRegistry* registry) override; | 42 shell::InterfaceRegistry* registry) override; |
| 43 | 43 |
| 44 // WindowTreeClientDelegate: | 44 // WindowTreeClientDelegate: |
| 45 void OnEmbed(Window* root) override; | 45 void OnEmbed(Window* root) override; |
| 46 void OnDidDestroyClient(WindowTreeClient* client) override; | 46 void OnEmbedRootDestroyed(Window* root) override; |
| 47 void OnLostConnection(WindowTreeClient* client) override; |
| 47 void OnPointerEventObserved(const PointerEvent& event, | 48 void OnPointerEventObserved(const PointerEvent& event, |
| 48 Window* target) override; | 49 Window* target) override; |
| 49 | 50 |
| 50 // WindowManagerDelegate: | 51 // WindowManagerDelegate: |
| 51 void SetWindowManagerClient(WindowManagerClient* client) override; | 52 void SetWindowManagerClient(WindowManagerClient* client) override; |
| 52 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override; | 53 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override; |
| 53 bool OnWmSetProperty( | 54 bool OnWmSetProperty( |
| 54 Window* window, | 55 Window* window, |
| 55 const std::string& name, | 56 const std::string& name, |
| 56 std::unique_ptr<std::vector<uint8_t>>* new_data) override; | 57 std::unique_ptr<std::vector<uint8_t>>* new_data) override; |
| 57 Window* OnWmCreateTopLevelWindow( | 58 Window* OnWmCreateTopLevelWindow( |
| 58 std::map<std::string, std::vector<uint8_t>>* properties) override; | 59 std::map<std::string, std::vector<uint8_t>>* properties) override; |
| 59 void OnWmClientJankinessChanged(const std::set<Window*>& client_windows, | 60 void OnWmClientJankinessChanged(const std::set<Window*>& client_windows, |
| 60 bool janky) override; | 61 bool janky) override; |
| 61 void OnWmNewDisplay(Window* window, const display::Display& display) override; | 62 void OnWmNewDisplay(Window* window, const display::Display& display) override; |
| 62 void OnWmPerformMoveLoop(Window* window, | 63 void OnWmPerformMoveLoop(Window* window, |
| 63 mojom::MoveLoopSource source, | 64 mojom::MoveLoopSource source, |
| 64 const gfx::Point& cursor_location, | 65 const gfx::Point& cursor_location, |
| 65 const base::Callback<void(bool)>& on_done) override; | 66 const base::Callback<void(bool)>& on_done) override; |
| 66 void OnWmCancelMoveLoop(Window* window) override; | 67 void OnWmCancelMoveLoop(Window* window) override; |
| 67 | 68 |
| 68 // Allocate a bitmap the same size as the window to draw into. | 69 // Allocate a bitmap the same size as the window to draw into. |
| 69 void AllocBitmap(); | 70 void AllocBitmap(); |
| 70 | 71 |
| 71 // Draws one frame, incrementing the rotation angle. | 72 // Draws one frame, incrementing the rotation angle. |
| 72 void DrawFrame(); | 73 void DrawFrame(); |
| 73 | 74 |
| 74 Window* window_ = nullptr; | 75 Window* window_ = nullptr; |
| 75 WindowTreeClient* window_tree_client_ = nullptr; | 76 std::unique_ptr<WindowTreeClient> window_tree_client_; |
| 76 std::unique_ptr<GpuService> gpu_service_; | 77 std::unique_ptr<GpuService> gpu_service_; |
| 77 | 78 |
| 78 // Used to send frames to mus. | 79 // Used to send frames to mus. |
| 79 std::unique_ptr<ui::BitmapUploader> uploader_; | 80 std::unique_ptr<BitmapUploader> uploader_; |
| 80 | 81 |
| 81 // Bitmap that is the same size as our client window area. | 82 // Bitmap that is the same size as our client window area. |
| 82 SkBitmap bitmap_; | 83 SkBitmap bitmap_; |
| 83 | 84 |
| 84 // Timer for calling DrawFrame(). | 85 // Timer for calling DrawFrame(). |
| 85 base::RepeatingTimer timer_; | 86 base::RepeatingTimer timer_; |
| 86 | 87 |
| 87 // Current rotation angle for drawing. | 88 // Current rotation angle for drawing. |
| 88 double angle_ = 0.0; | 89 double angle_ = 0.0; |
| 89 | 90 |
| 90 DISALLOW_COPY_AND_ASSIGN(MusDemo); | 91 DISALLOW_COPY_AND_ASSIGN(MusDemo); |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 } // namespace demo | 94 } // namespace demo |
| 94 } // namespace ui | 95 } // namespace ui |
| 95 | 96 |
| 96 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ | 97 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ |
| OLD | NEW |