Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: services/ui/demo/mus_demo.h

Issue 2622103004: Mus Demo: Demonstrate external window mode (Closed)
Patch Set: Add MusDemoExternal Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/interfaces/window_tree_host.mojom.h"
18 #include "ui/aura/mus/window_manager_delegate.h" 19 #include "ui/aura/mus/window_manager_delegate.h"
19 #include "ui/aura/mus/window_tree_client_delegate.h" 20 #include "ui/aura/mus/window_tree_client_delegate.h"
20 #include "ui/display/screen_base.h" 21 #include "ui/display/screen_base.h"
21 22
22 namespace aura { 23 namespace aura {
23 class Env; 24 class Env;
24 class PropertyConverter; 25 class PropertyConverter;
25 26
26 namespace client { 27 namespace client {
27 class DefaultCaptureClient; 28 class DefaultCaptureClient;
(...skipping 22 matching lines...) Expand all
50 ~MusDemo() override; 51 ~MusDemo() override;
51 52
52 protected: 53 protected:
53 virtual void OnStartImpl() = 0; 54 virtual void OnStartImpl() = 0;
54 55
55 class WindowTreeData { 56 class WindowTreeData {
56 public: 57 public:
57 explicit WindowTreeData( 58 explicit WindowTreeData(
58 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, 59 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host,
59 int square_size); 60 int square_size);
61 explicit WindowTreeData(mojom::WindowTreeHostFactory* factory,
62 mojom::WindowTreeClientPtr tree_client,
63 int square_size);
60 ~WindowTreeData(); 64 ~WindowTreeData();
61 65
62 private:
63 // Initializes the window tree host and start drawing frames. 66 // Initializes the window tree host and start drawing frames.
64 void Init(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host); 67 void Init(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host);
65 68
69 private:
66 // Draws one frame, incrementing the rotation angle. 70 // Draws one frame, incrementing the rotation angle.
67 void DrawFrame(); 71 void DrawFrame();
68 72
69 // Helper function to retrieve the window to which we draw the bitmap. 73 // Helper function to retrieve the window to which we draw the bitmap.
70 aura::Window* bitmap_window(); 74 aura::Window* bitmap_window();
71 75
72 // The Window tree host corresponding to this data. 76 // The Window tree host corresponding to this data.
73 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; 77 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_;
74 78
79 // When the WindowTreeData is created with WindowTreeHostFactory, this holds
80 // the Mojo pointer to the window tree host.
81 mojom::WindowTreeHostPtr host_;
82
75 // Destroys itself when the window gets destroyed. 83 // Destroys itself when the window gets destroyed.
76 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr; 84 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr;
77 85
78 // Timer for calling DrawFrame(). 86 // Timer for calling DrawFrame().
79 base::RepeatingTimer timer_; 87 base::RepeatingTimer timer_;
80 88
81 // Current rotation angle for drawing. 89 // Current rotation angle for drawing.
82 double angle_ = 0.0; 90 double angle_ = 0.0;
83 91
84 // Size in pixels of the square to draw. 92 // Size in pixels of the square to draw.
(...skipping 28 matching lines...) Expand all
113 std::unique_ptr<::wm::WMState> wm_state_; 121 std::unique_ptr<::wm::WMState> wm_state_;
114 std::unique_ptr<aura::PropertyConverter> property_converter_; 122 std::unique_ptr<aura::PropertyConverter> property_converter_;
115 123
116 DISALLOW_COPY_AND_ASSIGN(MusDemo); 124 DISALLOW_COPY_AND_ASSIGN(MusDemo);
117 }; 125 };
118 126
119 } // namespace demo 127 } // namespace demo
120 } // namespace aura 128 } // namespace aura
121 129
122 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ 130 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698