Chromium Code Reviews| Index: services/ui/demo/mus_demo.h |
| diff --git a/services/ui/demo/mus_demo.h b/services/ui/demo/mus_demo.h |
| index 941b2387be42874fd4287f2006f32215ba625cf4..63744630739ee630a9b876e3a20c32ac9e19eabd 100644 |
| --- a/services/ui/demo/mus_demo.h |
| +++ b/services/ui/demo/mus_demo.h |
| @@ -15,20 +15,36 @@ |
| #include "base/macros.h" |
| #include "base/timer/timer.h" |
| #include "services/service_manager/public/cpp/service.h" |
| -#include "services/ui/public/cpp/window_manager_delegate.h" |
| -#include "services/ui/public/cpp/window_tree_client_delegate.h" |
| #include "third_party/skia/include/core/SkBitmap.h" |
| +#include "ui/aura/mus/window_manager_delegate.h" |
| +#include "ui/aura/mus/window_tree_client_delegate.h" |
| #include "ui/display/screen_base.h" |
| namespace ui { |
| -class BitmapUploader; |
| +class ContextFactory; |
| class GpuService; |
| +class Layer; |
| +} |
| + |
| +namespace wm { |
| +class WMState; |
| +} |
| + |
| +namespace aura { |
|
sky
2016/12/05 16:06:41
As this file is the directory services/ui it shoul
mfomitchev
2016/12/05 21:11:21
Done.
|
| +class Env; |
| +class PropertyConverter; |
| + |
| +namespace client { |
| +class DefaultCaptureClient; |
| +} |
| namespace demo { |
| +class ImageLayerDelegate; |
| -// A simple MUS Demo service. This service connects to the service:ui, creates a |
| -// new window and draws a spinning square in the center of the window. Provides |
| -// a simple way to demonstrate that the graphic stack works as intended. |
| +// A simple MUS Demo service. This service connects to the service:ui, adds a |
| +// new layer to the root Window, and draws a spinning square in the center of |
| +// the layer. Provides a simple way to demonstrate that the graphic stack works |
| +// as intended. |
| class MusDemo : public service_manager::Service, |
| public WindowTreeClientDelegate, |
| public WindowManagerDelegate { |
| @@ -43,11 +59,14 @@ class MusDemo : public service_manager::Service, |
| service_manager::InterfaceRegistry* registry) override; |
| // WindowTreeClientDelegate: |
| - void OnEmbed(Window* root) override; |
| + void OnEmbed(std::unique_ptr<WindowTreeHostMus> window_tree_host) override; |
| + void OnUnembed(Window* root) override; |
| void OnEmbedRootDestroyed(Window* root) override; |
| void OnLostConnection(WindowTreeClient* client) override; |
| - void OnPointerEventObserved(const PointerEvent& event, |
| + void OnPointerEventObserved(const ui::PointerEvent& event, |
| Window* target) override; |
| + client::CaptureClient* GetCaptureClient() override; |
| + PropertyConverter* GetPropertyConverter() override; |
| // WindowManagerDelegate: |
| void SetWindowManagerClient(WindowManagerClient* client) override; |
| @@ -57,33 +76,45 @@ class MusDemo : public service_manager::Service, |
| const std::string& name, |
| std::unique_ptr<std::vector<uint8_t>>* new_data) override; |
| Window* OnWmCreateTopLevelWindow( |
| + ui::mojom::WindowType window_type, |
| std::map<std::string, std::vector<uint8_t>>* properties) override; |
| void OnWmClientJankinessChanged(const std::set<Window*>& client_windows, |
| bool janky) override; |
| - void OnWmNewDisplay(Window* window, const display::Display& display) override; |
| - void OnWmDisplayRemoved(ui::Window* window) override; |
| + void OnWmWillCreateDisplay(const display::Display& display) override; |
| + void OnWmNewDisplay(std::unique_ptr<WindowTreeHostMus> window_tree_host, |
| + const display::Display& display) override; |
| + void OnWmDisplayRemoved(WindowTreeHostMus* window_tree_host) override; |
| void OnWmDisplayModified(const display::Display& display) override; |
| + ui::mojom::EventResult OnAccelerator(uint32_t id, |
| + const ui::Event& event) override; |
| void OnWmPerformMoveLoop(Window* window, |
| - mojom::MoveLoopSource source, |
| + ui::mojom::MoveLoopSource source, |
| const gfx::Point& cursor_location, |
| const base::Callback<void(bool)>& on_done) override; |
| void OnWmCancelMoveLoop(Window* window) override; |
| - |
| - // Allocate a bitmap the same size as the window to draw into. |
| - void AllocBitmap(); |
| + void OnWmSetClientArea( |
| + Window* window, |
| + const gfx::Insets& insets, |
| + const std::vector<gfx::Rect>& additional_client_areas) override; |
| // Draws one frame, incrementing the rotation angle. |
| void DrawFrame(); |
| - Window* window_ = nullptr; |
| + Window* root_window_ = nullptr; |
| std::unique_ptr<WindowTreeClient> window_tree_client_; |
| - std::unique_ptr<GpuService> gpu_service_; |
| - |
| - // Dummy screen required to be the screen instance. |
| + std::unique_ptr<WindowTreeHostMus> window_tree_host_; |
| + std::unique_ptr<ui::GpuService> gpu_service_; |
| + std::unique_ptr<ui::ContextFactory> context_factory_; |
| + std::unique_ptr<Env> env_; |
| std::unique_ptr<display::ScreenBase> screen_; |
| - // Used to send frames to mus. |
| - std::unique_ptr<BitmapUploader> uploader_; |
| + std::unique_ptr<client::DefaultCaptureClient> capture_client_; |
| + std::unique_ptr<::wm::WMState> wm_state_; |
| + std::unique_ptr<aura::PropertyConverter> property_converter_; |
| + |
| + // Layer to which we draw the bitmap. |
|
sky
2016/12/05 16:06:41
Is there a reason you create a layer vs an aura::W
mfomitchev
2016/12/05 21:11:21
Done. Switched to Window.
|
| + std::unique_ptr<ui::Layer> bitmap_layer_; |
| + std::unique_ptr<ImageLayerDelegate> layer_delegate_; |
| // Bitmap that is the same size as our client window area. |
| SkBitmap bitmap_; |
| @@ -101,6 +132,6 @@ class MusDemo : public service_manager::Service, |
| }; |
| } // namespace demo |
| -} // namespace ui |
| +} // namespace aura |
| #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ |