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

Side by Side Diff: components/mus/demo/mus_demo.h

Issue 1882423004: Move shell service to toplevel shell namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
« no previous file with comments | « components/mus/demo/main.cc ('k') | components/mus/demo/mus_demo.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 COMPONENTS_MUS_DEMO_MUS_DEMO_H_ 5 #ifndef COMPONENTS_MUS_DEMO_MUS_DEMO_H_
6 #define COMPONENTS_MUS_DEMO_MUS_DEMO_H_ 6 #define COMPONENTS_MUS_DEMO_MUS_DEMO_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 13 matching lines...) Expand all
24 24
25 namespace bitmap_uploader { 25 namespace bitmap_uploader {
26 class BitmapUploader; 26 class BitmapUploader;
27 } 27 }
28 28
29 namespace mus_demo { 29 namespace mus_demo {
30 30
31 // A simple MUS Demo mojo app. This app connects to the mojo:mus, creates a new 31 // A simple MUS Demo mojo app. This app connects to the mojo:mus, creates a new
32 // window and draws a spinning square in the center of the window. Provides a 32 // window and draws a spinning square in the center of the window. Provides a
33 // simple way to demonstrate that the graphic stack works as intended. 33 // simple way to demonstrate that the graphic stack works as intended.
34 class MusDemo : public mojo::ShellClient, 34 class MusDemo : public shell::ShellClient,
35 public mus::WindowTreeDelegate, 35 public mus::WindowTreeDelegate,
36 public mus::WindowManagerDelegate { 36 public mus::WindowManagerDelegate {
37 public: 37 public:
38 MusDemo(); 38 MusDemo();
39 ~MusDemo() override; 39 ~MusDemo() override;
40 40
41 private: 41 private:
42 // mojo::ShellClient: 42 // shell::ShellClient:
43 void Initialize(mojo::Connector* connector, 43 void Initialize(shell::Connector* connector,
44 const mojo::Identity& identity, 44 const shell::Identity& identity,
45 uint32_t id) override; 45 uint32_t id) override;
46 bool AcceptConnection(mojo::Connection* connection) override; 46 bool AcceptConnection(shell::Connection* connection) override;
47 47
48 // WindowTreeDelegate: 48 // WindowTreeDelegate:
49 void OnEmbed(mus::Window* root) override; 49 void OnEmbed(mus::Window* root) override;
50 void OnUnembed(mus::Window* root) override; 50 void OnUnembed(mus::Window* root) override;
51 void OnConnectionLost(mus::WindowTreeConnection* connection) override; 51 void OnConnectionLost(mus::WindowTreeConnection* connection) override;
52 52
53 // WindowManagerDelegate: 53 // WindowManagerDelegate:
54 void SetWindowManagerClient(mus::WindowManagerClient* client) override; 54 void SetWindowManagerClient(mus::WindowManagerClient* client) override;
55 bool OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) override; 55 bool OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) override;
56 bool OnWmSetProperty(mus::Window* window, 56 bool OnWmSetProperty(mus::Window* window,
57 const std::string& name, 57 const std::string& name,
58 scoped_ptr<std::vector<uint8_t>>* new_data) override; 58 scoped_ptr<std::vector<uint8_t>>* new_data) override;
59 mus::Window* OnWmCreateTopLevelWindow( 59 mus::Window* OnWmCreateTopLevelWindow(
60 std::map<std::string, std::vector<uint8_t>>* properties) override; 60 std::map<std::string, std::vector<uint8_t>>* properties) override;
61 void OnAccelerator(uint32_t id, const ui::Event& event) override; 61 void OnAccelerator(uint32_t id, const ui::Event& event) override;
62 62
63 // Allocate a bitmap the same size as the window to draw into. 63 // Allocate a bitmap the same size as the window to draw into.
64 void AllocBitmap(); 64 void AllocBitmap();
65 65
66 // Draws one frame, incrementing the rotation angle. 66 // Draws one frame, incrementing the rotation angle.
67 void DrawFrame(); 67 void DrawFrame();
68 68
69 mojo::Connector* connector_ = nullptr; 69 shell::Connector* connector_ = nullptr;
70 70
71 mus::Window* window_ = nullptr; 71 mus::Window* window_ = nullptr;
72 mus::mojom::WindowTreeHostPtr window_tree_host_; 72 mus::mojom::WindowTreeHostPtr window_tree_host_;
73 73
74 // Used to send frames to mus. 74 // Used to send frames to mus.
75 scoped_ptr<bitmap_uploader::BitmapUploader> uploader_; 75 scoped_ptr<bitmap_uploader::BitmapUploader> uploader_;
76 76
77 // Bitmap that is the same size as our client window area. 77 // Bitmap that is the same size as our client window area.
78 SkBitmap bitmap_; 78 SkBitmap bitmap_;
79 79
80 // Timer for calling DrawFrame(). 80 // Timer for calling DrawFrame().
81 base::RepeatingTimer timer_; 81 base::RepeatingTimer timer_;
82 82
83 // Current rotation angle for drawing. 83 // Current rotation angle for drawing.
84 double angle_ = 0.0; 84 double angle_ = 0.0;
85 85
86 DISALLOW_COPY_AND_ASSIGN(MusDemo); 86 DISALLOW_COPY_AND_ASSIGN(MusDemo);
87 }; 87 };
88 88
89 } // namespace mus_demo 89 } // namespace mus_demo
90 90
91 #endif // COMPONENTS_MUS_DEMO_MUS_DEMO_H_ 91 #endif // COMPONENTS_MUS_DEMO_MUS_DEMO_H_
OLDNEW
« no previous file with comments | « components/mus/demo/main.cc ('k') | components/mus/demo/mus_demo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698