OLD | NEW |
---|---|
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 28 matching lines...) Expand all Loading... | |
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 | 47 |
48 // These functions help to manage the list of WindowTreeData structures. | 48 // These functions help to manage the list of WindowTreeData structures. |
49 // AppendWindowTreeData is used to add an uninitialized structure at the end | 49 // AppendWindowTreeData is used to add uninitialized structures at the end |
50 // of the list. When a new WindowTreeHostMus is created and is sent to | 50 // of the list. When a new WindowTreeHostMus is created and is sent to |
51 // MusDemo (via OnWmNewDisplay or OnEmbed), the WindowTreeData is initialized | 51 // MusDemo via OnWmNewDisplay, the WindowTreeData is initialized |
52 // by a call to InitWindowTreeData and the demo starts. When the destruction | 52 // by a call to InitWindowTreeData and the demo starts. In case if |
53 // of the WindowTreeHostMus is announced to MusDemo (via OnWmDisplayRemoved | 53 // OnEmbedRootReady is called, corresponding WindowTreeData is found by |
54 // or OnEmbedRootDestroyed), the corresponding WindowTreeData is removed by | 54 // looking associated WindowTreeHostMus with it. When the destruction of the |
55 // a call to RemoveWindowTreeData. | 55 // WindowTreeHostMus is announced to MusDemo (via OnWmDisplayRemoved or |
56 // OnEmbedRootDestroyed), the corresponding WindowTreeData is removed by a | |
57 // call to RemoveWindowTreeData. | |
56 void AppendWindowTreeData(std::unique_ptr<WindowTreeData> window_tree_data); | 58 void AppendWindowTreeData(std::unique_ptr<WindowTreeData> window_tree_data); |
57 void InitWindowTreeData( | 59 void InitWindowTreeData( |
58 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host); | 60 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host); |
61 // Is called in case if OnEmbedRootReady is called. Uses WindowTreeHostMus* | |
62 // to find an associated WindowTreeData with it. | |
63 void InitWindowTreeDataExternal(aura::WindowTreeHostMus* window_tree_host); | |
fwang
2017/03/16 08:59:48
I would make HasPendingWindowTreeData protected an
msisov(use msisov igalia.com)
2017/03/16 09:21:32
Agree, HasPendingWindowTreeData is not longer need
| |
59 void RemoveWindowTreeData(aura::WindowTreeHostMus* window_tree_host); | 64 void RemoveWindowTreeData(aura::WindowTreeHostMus* window_tree_host); |
65 std::vector<std::unique_ptr<WindowTreeData>>::iterator FindWindowTreeData( | |
66 aura::WindowTreeHostMus* window_tree_host); | |
60 | 67 |
61 aura::WindowTreeClient* window_tree_client() { | 68 aura::WindowTreeClient* window_tree_client() { |
62 return window_tree_client_.get(); | 69 return window_tree_client_.get(); |
63 } | 70 } |
64 | 71 |
65 private: | 72 private: |
66 virtual void OnStartImpl() = 0; | 73 virtual void OnStartImpl() = 0; |
67 virtual std::unique_ptr<aura::WindowTreeClient> CreateWindowTreeClient() = 0; | 74 virtual std::unique_ptr<aura::WindowTreeClient> CreateWindowTreeClient() = 0; |
68 bool HasPendingWindowTreeData() const; | 75 bool HasPendingWindowTreeData() const; |
69 | 76 |
(...skipping 25 matching lines...) Expand all Loading... | |
95 // next call to InitWindowTreeData. | 102 // next call to InitWindowTreeData. |
96 std::vector<std::unique_ptr<WindowTreeData>> window_tree_data_list_; | 103 std::vector<std::unique_ptr<WindowTreeData>> window_tree_data_list_; |
97 | 104 |
98 DISALLOW_COPY_AND_ASSIGN(MusDemo); | 105 DISALLOW_COPY_AND_ASSIGN(MusDemo); |
99 }; | 106 }; |
100 | 107 |
101 } // namespace demo | 108 } // namespace demo |
102 } // namespace ui | 109 } // namespace ui |
103 | 110 |
104 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ | 111 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ |
OLD | NEW |