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

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

Issue 2700493005: Mus Demo: Refactor code to prepare multiple windows in external mode (Closed)
Patch Set: Rename MusExternal::tree_client_ & describes the helper functions for WindowTreeData. 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
« no previous file with comments | « no previous file | services/ui/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 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 <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 26 matching lines...) Expand all
37 // the window. Provides a simple way to demonstrate that the graphic stack works 37 // the window. Provides a simple way to demonstrate that the graphic stack works
38 // as intended. 38 // as intended.
39 class MusDemo : public service_manager::Service, 39 class MusDemo : public service_manager::Service,
40 public aura::WindowTreeClientDelegate { 40 public aura::WindowTreeClientDelegate {
41 public: 41 public:
42 MusDemo(); 42 MusDemo();
43 ~MusDemo() override; 43 ~MusDemo() override;
44 44
45 protected: 45 protected:
46 void AddPrimaryDisplay(const display::Display& display); 46 void AddPrimaryDisplay(const display::Display& display);
47
48 // These functions help to manage the list of WindowTreeData structures.
49 // AppendWindowTreeData is used to add an uninitialized structure at the end
50 // of the list. When a new WindowTreeHostMus is created and is sent to
51 // MusDemo (via OnWmNewDisplay or OnEmbed), the WindowTreeData is initialized
52 // by a call to InitWindowTreeData and the demo starts. When the destruction
53 // of the WindowTreeHostMus is announced to MusDemo (via OnWmDisplayRemoved
54 // or OnEmbedRootDestroyed), the corresponding WindowTreeData is removed by
55 // a call to RemoveWindowTreeData.
56 void AppendWindowTreeData(std::unique_ptr<WindowTreeData> window_tree_data);
47 void InitWindowTreeData( 57 void InitWindowTreeData(
48 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host); 58 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host);
49 void CleanupWindowTreeData(); 59 void RemoveWindowTreeData(aura::WindowTreeHostMus* window_tree_host);
60
61 aura::WindowTreeClient* window_tree_client() {
62 return window_tree_client_.get();
63 }
50 64
51 private: 65 private:
52 virtual void OnStartImpl( 66 virtual void OnStartImpl() = 0;
53 std::unique_ptr<aura::WindowTreeClient>* window_tree_client, 67 virtual std::unique_ptr<aura::WindowTreeClient> CreateWindowTreeClient() = 0;
54 std::unique_ptr<WindowTreeData>* window_tree_data) = 0; 68 bool HasPendingWindowTreeData() const;
55 69
56 // service_manager::Service: 70 // service_manager::Service:
57 void OnStart() override; 71 void OnStart() override;
58 bool OnConnect(const service_manager::ServiceInfo& remote_info, 72 bool OnConnect(const service_manager::ServiceInfo& remote_info,
59 service_manager::InterfaceRegistry* registry) override; 73 service_manager::InterfaceRegistry* registry) override;
60 74
61 // aura::WindowTreeClientDelegate: 75 // aura::WindowTreeClientDelegate:
62 void OnEmbed( 76 void OnEmbed(
63 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override; 77 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override;
64 void OnUnembed(aura::Window* root) override; 78 void OnUnembed(aura::Window* root) override;
65 void OnEmbedRootDestroyed(aura::WindowTreeHostMus* window_tree_host) override; 79 void OnEmbedRootDestroyed(aura::WindowTreeHostMus* window_tree_host) override;
66 void OnLostConnection(aura::WindowTreeClient* client) override; 80 void OnLostConnection(aura::WindowTreeClient* client) override;
67 void OnPointerEventObserved(const ui::PointerEvent& event, 81 void OnPointerEventObserved(const ui::PointerEvent& event,
68 aura::Window* target) override; 82 aura::Window* target) override;
69 aura::PropertyConverter* GetPropertyConverter() override; 83 aura::PropertyConverter* GetPropertyConverter() override;
70 84
71 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; 85 std::unique_ptr<aura::WindowTreeClient> window_tree_client_;
72 std::unique_ptr<aura::Env> env_; 86 std::unique_ptr<aura::Env> env_;
73 std::unique_ptr<display::ScreenBase> screen_; 87 std::unique_ptr<display::ScreenBase> screen_;
74 88
75 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; 89 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_;
76 std::unique_ptr<::wm::WMState> wm_state_; 90 std::unique_ptr<::wm::WMState> wm_state_;
77 std::unique_ptr<aura::PropertyConverter> property_converter_; 91 std::unique_ptr<aura::PropertyConverter> property_converter_;
78 92
79 std::unique_ptr<WindowTreeData> window_tree_data_; 93 // List of WindowTreeData structures. When a new window is opened, its data
94 // is appended at the end of that list and it remains uninitialized until the
95 // next call to InitWindowTreeData.
96 std::vector<std::unique_ptr<WindowTreeData>> window_tree_data_list_;
80 97
81 DISALLOW_COPY_AND_ASSIGN(MusDemo); 98 DISALLOW_COPY_AND_ASSIGN(MusDemo);
82 }; 99 };
83 100
84 } // namespace demo 101 } // namespace demo
85 } // namespace ui 102 } // namespace ui
86 103
87 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ 104 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/demo/mus_demo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698