| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_LAUNCHER_VIEW_TREE_IMPL_H_ | 5 #ifndef SERVICES_UI_LAUNCHER_VIEW_TREE_IMPL_H_ | 
| 6 #define SERVICES_UI_LAUNCHER_VIEW_TREE_IMPL_H_ | 6 #define SERVICES_UI_LAUNCHER_VIEW_TREE_IMPL_H_ | 
| 7 | 7 | 
| 8 #include "base/callback.h" | 8 #include "base/callback.h" | 
| 9 #include "base/macros.h" | 9 #include "base/macros.h" | 
| 10 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" | 
| 11 #include "mojo/services/gfx/composition/interfaces/compositor.mojom.h" | 11 #include "mojo/services/gfx/composition/interfaces/compositor.mojom.h" | 
| 12 #include "mojo/services/native_viewport/interfaces/native_viewport.mojom.h" | 12 #include "mojo/services/native_viewport/interfaces/native_viewport.mojom.h" | 
| 13 #include "mojo/services/ui/input/interfaces/input_dispatcher.mojom.h" | 13 #include "mojo/services/ui/input/interfaces/input_dispatcher.mojom.h" | 
| 14 #include "mojo/services/ui/views/interfaces/view_manager.mojom.h" | 14 #include "mojo/services/ui/views/interfaces/view_manager.mojom.h" | 
| 15 | 15 | 
| 16 namespace launcher { | 16 namespace launcher { | 
| 17 | 17 | 
| 18 class LauncherViewTree : public mojo::ui::ViewTree, | 18 class LauncherViewTree : public mojo::ui::ViewTree, | 
| 19                          public mojo::gfx::composition::SceneListener { | 19                          public mojo::gfx::composition::SceneListener { | 
| 20  public: | 20  public: | 
| 21   LauncherViewTree(mojo::gfx::composition::Compositor* compositor, | 21   LauncherViewTree(mojo::gfx::composition::Compositor* compositor, | 
| 22                    mojo::ui::ViewManager* view_manager, | 22                    mojo::ui::ViewManager* view_manager, | 
| 23                    mojo::ContextProviderPtr context_provider, | 23                    mojo::ContextProviderPtr context_provider, | 
| 24                    mojo::ViewportMetricsPtr viewport_metrics, | 24                    mojo::ViewportMetricsPtr viewport_metrics, | 
| 25                    const base::Closure& shutdown_callback); | 25                    const base::Closure& shutdown_callback); | 
| 26 | 26 | 
| 27   ~LauncherViewTree() override; | 27   ~LauncherViewTree() override; | 
| 28 | 28 | 
| 29   void SetRoot(mojo::ui::ViewTokenPtr token); | 29   void SetRoot(mojo::ui::ViewOwnerPtr owner); | 
| 30   void SetViewportMetrics(mojo::ViewportMetricsPtr viewport_metrics); | 30   void SetViewportMetrics(mojo::ViewportMetricsPtr viewport_metrics); | 
| 31   void DispatchEvent(mojo::EventPtr event); | 31   void DispatchEvent(mojo::EventPtr event); | 
| 32 | 32 | 
| 33  private: | 33  private: | 
| 34   // |SceneListener|: | 34   // |SceneListener|: | 
| 35   void OnResourceUnavailable( | 35   void OnResourceUnavailable( | 
| 36       uint32_t resource_id, | 36       uint32_t resource_id, | 
| 37       const OnResourceUnavailableCallback& callback) override; | 37       const OnResourceUnavailableCallback& callback) override; | 
| 38 | 38 | 
| 39   // |ViewTree|: | 39   // |ViewTree|: | 
| 40   void OnLayout(const OnLayoutCallback& callback) override; | 40   void OnLayout(const OnLayoutCallback& callback) override; | 
| 41   void OnRootUnavailable(uint32_t root_key, | 41   void OnRootUnavailable(uint32_t root_key, | 
| 42                          const OnRootUnavailableCallback& callback) override; | 42                          const OnRootUnavailableCallback& callback) override; | 
| 43 | 43 | 
| 44   void OnRendererConnectionError(); | 44   void OnRendererConnectionError(); | 
| 45   void OnSceneConnectionError(); | 45   void OnSceneConnectionError(); | 
| 46   void OnViewTreeConnectionError(); | 46   void OnViewTreeConnectionError(); | 
| 47   void OnInputDispatcherConnectionError(); | 47   void OnInputDispatcherConnectionError(); | 
| 48 | 48 | 
| 49   void OnSceneRegistered(mojo::gfx::composition::SceneTokenPtr scene_token); | 49   void OnSceneRegistered(mojo::gfx::composition::SceneTokenPtr scene_token); | 
| 50   void OnViewTreeRegistered(mojo::ui::ViewTreeTokenPtr view_tree_token); |  | 
| 51 | 50 | 
| 52   void LayoutRoot(); | 51   void LayoutRoot(); | 
| 53   void OnLayoutResult(mojo::ui::ViewLayoutInfoPtr info); | 52   void OnLayoutResult(mojo::ui::ViewLayoutInfoPtr info); | 
| 54 | 53 | 
| 55   void SetRootScene(); | 54   void SetRootScene(); | 
| 56 | 55 | 
| 57   void PublishFrame(); | 56   void PublishFrame(); | 
| 58 | 57 | 
| 59   void Shutdown(); | 58   void Shutdown(); | 
| 60 | 59 | 
| 61   mojo::gfx::composition::Compositor* compositor_; | 60   mojo::gfx::composition::Compositor* compositor_; | 
| 62   mojo::ui::ViewManager* view_manager_; | 61   mojo::ui::ViewManager* view_manager_; | 
| 63 | 62 | 
| 64   mojo::ContextProviderPtr context_provider_; | 63   mojo::ContextProviderPtr context_provider_; | 
| 65   mojo::ViewportMetricsPtr viewport_metrics_; | 64   mojo::ViewportMetricsPtr viewport_metrics_; | 
| 66   base::Closure shutdown_callback_; | 65   base::Closure shutdown_callback_; | 
| 67 | 66 | 
| 68   mojo::Binding<mojo::gfx::composition::SceneListener> scene_listener_binding_; | 67   mojo::Binding<mojo::gfx::composition::SceneListener> scene_listener_binding_; | 
| 69   mojo::Binding<mojo::ui::ViewTree> view_tree_binding_; | 68   mojo::Binding<mojo::ui::ViewTree> view_tree_binding_; | 
| 70 | 69 | 
| 71   mojo::gfx::composition::ScenePtr scene_; | 70   mojo::gfx::composition::ScenePtr scene_; | 
| 72   mojo::gfx::composition::SceneTokenPtr scene_token_; | 71   mojo::gfx::composition::SceneTokenPtr scene_token_; | 
| 73   uint32_t scene_version_ = 1u; | 72   uint32_t scene_version_ = 1u; | 
| 74 | 73 | 
| 75   mojo::gfx::composition::RendererPtr renderer_; | 74   mojo::gfx::composition::RendererPtr renderer_; | 
| 76   mojo::ui::ViewTreeHostPtr view_tree_host_; | 75   mojo::ui::ViewTreeHostPtr view_tree_host_; | 
| 77   mojo::ui::InputDispatcherPtr input_dispatcher_; | 76   mojo::ui::InputDispatcherPtr input_dispatcher_; | 
| 78 | 77 | 
| 79   mojo::ui::ViewTokenPtr root_; |  | 
| 80   uint32_t root_key_ = 0u; | 78   uint32_t root_key_ = 0u; | 
|  | 79   bool root_was_set_ = false; | 
| 81   mojo::ui::ViewLayoutInfoPtr root_layout_info_; | 80   mojo::ui::ViewLayoutInfoPtr root_layout_info_; | 
| 82 | 81 | 
| 83   DISALLOW_COPY_AND_ASSIGN(LauncherViewTree); | 82   DISALLOW_COPY_AND_ASSIGN(LauncherViewTree); | 
| 84 }; | 83 }; | 
| 85 | 84 | 
| 86 }  // namespace launcher | 85 }  // namespace launcher | 
| 87 | 86 | 
| 88 #endif  // SERVICES_UI_LAUNCHER_VIEW_TREE_IMPL_H_ | 87 #endif  // SERVICES_UI_LAUNCHER_VIEW_TREE_IMPL_H_ | 
| OLD | NEW | 
|---|