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

Unified Diff: services/ui/demo/window_tree_data.h

Issue 2697013004: Reland Mus Demo: Move definition of WindowTreeData into separate files (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/demo/mus_demo.cc ('k') | services/ui/demo/window_tree_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/demo/window_tree_data.h
diff --git a/services/ui/demo/window_tree_data.h b/services/ui/demo/window_tree_data.h
new file mode 100644
index 0000000000000000000000000000000000000000..0e1bcbd0806f8cc96f1feb5cdaf4c26a18b5d571
--- /dev/null
+++ b/services/ui/demo/window_tree_data.h
@@ -0,0 +1,60 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_
+#define SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_
+
+#include "base/memory/ptr_util.h"
+#include "base/timer/timer.h"
+
+namespace aura {
+class Window;
+class WindowTreeHostMus;
+} // namespace aura
+
+namespace aura_extra {
+class ImageWindowDelegate;
+} // namespace aura_extra
+
+namespace ui {
+namespace demo {
+
+class WindowTreeData {
+ public:
+ explicit WindowTreeData(int square_size);
+ ~WindowTreeData();
+
+ // Initializes the window tree host and start drawing frames.
+ void Init(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host);
+ bool IsInitialized() const { return !!window_tree_host_; }
+
+ private:
+ // Draws one frame, incrementing the rotation angle.
+ void DrawFrame();
+
+ // Helper function to retrieve the window to which we draw the bitmap.
+ aura::Window* bitmap_window();
+
+ // The Window tree host corresponding to this data.
+ std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_;
+
+ // Destroys itself when the window gets destroyed.
+ aura_extra::ImageWindowDelegate* window_delegate_ = nullptr;
+
+ // Timer for calling DrawFrame().
+ base::RepeatingTimer timer_;
+
+ // Current rotation angle for drawing.
+ double angle_ = 0.0;
+
+ // Size in pixels of the square to draw.
+ const int square_size_;
+
+ DISALLOW_COPY_AND_ASSIGN(WindowTreeData);
+};
+
+} // namespace demo
+} // namespace ui
+
+#endif // SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_
« no previous file with comments | « services/ui/demo/mus_demo.cc ('k') | services/ui/demo/window_tree_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698