Chromium Code Reviews| 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/service_manager/public/cpp/service.h" | 17 #include "services/service_manager/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 ui { | 22 namespace ui { |
| 23 class BitmapUploader; | 23 class BitmapUploader; |
| 24 class GpuService; | 24 class GpuService; |
| 25 | 25 |
| 26 namespace demo { | 26 namespace demo { |
| 27 | 27 |
| 28 // A simple MUS Demo service. This service connects to the mojo:ui, creates a | 28 // A simple MUS Demo. It connects to the service:ui, creates a new window and |
| 29 // new window and draws a spinning square in the center of the window. Provides | 29 // draws a spinning square in the center of the window. Provides a simple way |
| 30 // a simple way to demonstrate that the graphic stack works as intended. | 30 // to demonstrate that the graphic stack works as intended. |
| 31 class MusDemo : public service_manager::Service, | 31 class MusDemo : public WindowTreeClientDelegate, |
| 32 public WindowTreeClientDelegate, | |
| 33 public WindowManagerDelegate { | 32 public WindowManagerDelegate { |
| 34 public: | 33 public: |
| 35 MusDemo(); | 34 MusDemo(); |
| 36 ~MusDemo() override; | 35 ~MusDemo() override; |
| 37 | 36 |
| 37 void Start(service_manager::Connector* connector); | |
|
sky
2016/10/21 23:18:23
Start->Init
Jay Civelli
2016/10/22 00:00:16
Start seems more appropriate since it is really st
| |
| 38 | |
| 38 private: | 39 private: |
| 39 // service_manager::Service: | |
| 40 void OnStart(const service_manager::Identity& identity) override; | |
| 41 bool OnConnect(const service_manager::Identity& remote_identity, | |
| 42 service_manager::InterfaceRegistry* registry) override; | |
| 43 | |
| 44 // WindowTreeClientDelegate: | 40 // WindowTreeClientDelegate: |
| 45 void OnEmbed(Window* root) override; | 41 void OnEmbed(Window* root) override; |
| 46 void OnEmbedRootDestroyed(Window* root) override; | 42 void OnEmbedRootDestroyed(Window* root) override; |
| 47 void OnLostConnection(WindowTreeClient* client) override; | 43 void OnLostConnection(WindowTreeClient* client) override; |
| 48 void OnPointerEventObserved(const PointerEvent& event, | 44 void OnPointerEventObserved(const PointerEvent& event, |
| 49 Window* target) override; | 45 Window* target) override; |
| 50 | 46 |
| 51 // WindowManagerDelegate: | 47 // WindowManagerDelegate: |
| 52 void SetWindowManagerClient(WindowManagerClient* client) override; | 48 void SetWindowManagerClient(WindowManagerClient* client) override; |
| 53 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override; | 49 bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 82 | 78 |
| 83 // Bitmap that is the same size as our client window area. | 79 // Bitmap that is the same size as our client window area. |
| 84 SkBitmap bitmap_; | 80 SkBitmap bitmap_; |
| 85 | 81 |
| 86 // Timer for calling DrawFrame(). | 82 // Timer for calling DrawFrame(). |
| 87 base::RepeatingTimer timer_; | 83 base::RepeatingTimer timer_; |
| 88 | 84 |
| 89 // Current rotation angle for drawing. | 85 // Current rotation angle for drawing. |
| 90 double angle_ = 0.0; | 86 double angle_ = 0.0; |
| 91 | 87 |
| 88 // Last time a frame was drawn. | |
| 89 base::TimeTicks last_draw_frame_time_; | |
| 90 | |
| 92 DISALLOW_COPY_AND_ASSIGN(MusDemo); | 91 DISALLOW_COPY_AND_ASSIGN(MusDemo); |
| 93 }; | 92 }; |
| 94 | 93 |
| 95 } // namespace demo | 94 } // namespace demo |
| 96 } // namespace ui | 95 } // namespace ui |
| 97 | 96 |
| 98 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ | 97 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ |
| OLD | NEW |