Chromium Code Reviews| 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); |
|
fwang
2017/03/16 10:54:55
Shoudn't this be removed?
msisov(use msisov igalia.com)
2017/03/16 11:06:33
Done.
| |
| 59 void RemoveWindowTreeData(aura::WindowTreeHostMus* window_tree_host); | 61 void RemoveWindowTreeData(aura::WindowTreeHostMus* window_tree_host); |
| 62 std::vector<std::unique_ptr<WindowTreeData>>::iterator FindWindowTreeData( | |
| 63 aura::WindowTreeHostMus* window_tree_host); | |
| 60 | 64 |
| 61 aura::WindowTreeClient* window_tree_client() { | 65 aura::WindowTreeClient* window_tree_client() { |
| 62 return window_tree_client_.get(); | 66 return window_tree_client_.get(); |
| 63 } | 67 } |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 virtual void OnStartImpl() = 0; | 70 virtual void OnStartImpl() = 0; |
| 67 virtual std::unique_ptr<aura::WindowTreeClient> CreateWindowTreeClient() = 0; | 71 virtual std::unique_ptr<aura::WindowTreeClient> CreateWindowTreeClient() = 0; |
| 68 bool HasPendingWindowTreeData() const; | |
| 69 | 72 |
| 70 // service_manager::Service: | 73 // service_manager::Service: |
| 71 void OnStart() override; | 74 void OnStart() override; |
| 72 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 75 bool OnConnect(const service_manager::ServiceInfo& remote_info, |
| 73 service_manager::InterfaceRegistry* registry) override; | 76 service_manager::InterfaceRegistry* registry) override; |
| 74 | 77 |
| 75 // aura::WindowTreeClientDelegate: | 78 // aura::WindowTreeClientDelegate: |
| 76 void OnEmbed( | 79 void OnEmbed( |
| 77 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override; | 80 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override; |
| 78 void OnUnembed(aura::Window* root) override; | 81 void OnUnembed(aura::Window* root) override; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 95 // next call to InitWindowTreeData. | 98 // next call to InitWindowTreeData. |
| 96 std::vector<std::unique_ptr<WindowTreeData>> window_tree_data_list_; | 99 std::vector<std::unique_ptr<WindowTreeData>> window_tree_data_list_; |
| 97 | 100 |
| 98 DISALLOW_COPY_AND_ASSIGN(MusDemo); | 101 DISALLOW_COPY_AND_ASSIGN(MusDemo); |
| 99 }; | 102 }; |
| 100 | 103 |
| 101 } // namespace demo | 104 } // namespace demo |
| 102 } // namespace ui | 105 } // namespace ui |
| 103 | 106 |
| 104 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ | 107 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ |
| OLD | NEW |