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

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

Issue 2622103004: Mus Demo: Demonstrate external window mode (Closed)
Patch Set: Only disable the assert in external mode for now. 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_WINDOW_TREE_DATA_H_ 5 #ifndef SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_
6 #define SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ 6 #define SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "services/ui/public/interfaces/window_tree_host.mojom.h"
10 11
11 namespace aura { 12 namespace aura {
12 class Window; 13 class Window;
13 class WindowTreeHostMus; 14 class WindowTreeHostMus;
14 } // namespace aura 15 } // namespace aura
15 16
16 namespace aura_extra { 17 namespace aura_extra {
17 class ImageWindowDelegate; 18 class ImageWindowDelegate;
18 } // namespace aura_extra 19 } // namespace aura_extra
19 20
20 namespace ui { 21 namespace ui {
21 namespace demo { 22 namespace demo {
22 23
23 class WindowTreeData { 24 class WindowTreeData {
24 public: 25 public:
25 explicit WindowTreeData(int square_size); 26 explicit WindowTreeData(int square_size);
kylechar 2017/02/21 15:15:11 What is the difference between the two constructor
fwang 2017/02/21 17:30:19 The new one is only used in external mode. I've mo
27 explicit WindowTreeData(mojom::WindowTreeHostFactory* factory,
kylechar 2017/02/21 15:15:11 Only constructor with a single parameter should be
fwang 2017/02/21 17:30:19 Done.
28 mojom::WindowTreeClientPtr tree_client,
29 int square_size);
26 ~WindowTreeData(); 30 ~WindowTreeData();
27 31
28 // Initializes the window tree host and start drawing frames. 32 // Initializes the window tree host and start drawing frames.
29 void Init(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host); 33 void Init(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host);
30 bool IsInitialized() const { return !!window_tree_host_; } 34 bool IsInitialized() const { return !!window_tree_host_; }
31 35
32 private: 36 private:
33 // Draws one frame, incrementing the rotation angle. 37 // Draws one frame, incrementing the rotation angle.
34 void DrawFrame(); 38 void DrawFrame();
35 39
36 // Helper function to retrieve the window to which we draw the bitmap. 40 // Helper function to retrieve the window to which we draw the bitmap.
37 aura::Window* bitmap_window(); 41 aura::Window* bitmap_window();
38 42
39 // The Window tree host corresponding to this data. 43 // The Window tree host corresponding to this data.
40 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; 44 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_;
41 45
46 // When the WindowTreeData is created with WindowTreeHostFactory, this holds
47 // the Mojo pointer to the window tree host.
48 mojom::WindowTreeHostPtr host_;
kylechar 2017/02/21 15:15:11 Is this only needed for external mode? Can we some
fwang 2017/02/21 17:30:19 Yes. All these data will be moved to a WindowTreeD
49
42 // Destroys itself when the window gets destroyed. 50 // Destroys itself when the window gets destroyed.
43 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr; 51 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr;
44 52
45 // Timer for calling DrawFrame(). 53 // Timer for calling DrawFrame().
46 base::RepeatingTimer timer_; 54 base::RepeatingTimer timer_;
47 55
48 // Current rotation angle for drawing. 56 // Current rotation angle for drawing.
49 double angle_ = 0.0; 57 double angle_ = 0.0;
50 58
51 // Size in pixels of the square to draw. 59 // Size in pixels of the square to draw.
52 const int square_size_; 60 const int square_size_;
53 61
54 DISALLOW_COPY_AND_ASSIGN(WindowTreeData); 62 DISALLOW_COPY_AND_ASSIGN(WindowTreeData);
55 }; 63 };
56 64
57 } // namespace demo 65 } // namespace demo
58 } // namespace ui 66 } // namespace ui
59 67
60 #endif // SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ 68 #endif // SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698