| 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 UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ | 5 #ifndef UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ |
| 6 #define UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ | 6 #define UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // WindowManagerConnection is a singleton and should be created early on. | 48 // WindowManagerConnection is a singleton and should be created early on. |
| 49 // | 49 // |
| 50 // TODO(sky): this name is now totally confusing. Come up with a better one. | 50 // TODO(sky): this name is now totally confusing. Come up with a better one. |
| 51 class VIEWS_MUS_EXPORT WindowManagerConnection | 51 class VIEWS_MUS_EXPORT WindowManagerConnection |
| 52 : public NON_EXPORTED_BASE(ui::WindowTreeClientDelegate), | 52 : public NON_EXPORTED_BASE(ui::WindowTreeClientDelegate), |
| 53 public ScreenMusDelegate, | 53 public ScreenMusDelegate, |
| 54 public ui::OSExchangeDataProviderFactory::Factory { | 54 public ui::OSExchangeDataProviderFactory::Factory { |
| 55 public: | 55 public: |
| 56 ~WindowManagerConnection() override; | 56 ~WindowManagerConnection() override; |
| 57 | 57 |
| 58 // |io_task_runner| is used by the gpu service. If no task runner is provided, |
| 59 // then a new thread is created and used by ui::GpuService. |
| 58 static std::unique_ptr<WindowManagerConnection> Create( | 60 static std::unique_ptr<WindowManagerConnection> Create( |
| 59 shell::Connector* connector, | 61 shell::Connector* connector, |
| 60 const shell::Identity& identity); | 62 const shell::Identity& identity, |
| 63 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr); |
| 61 static WindowManagerConnection* Get(); | 64 static WindowManagerConnection* Get(); |
| 62 static bool Exists(); | 65 static bool Exists(); |
| 63 | 66 |
| 64 PointerWatcherEventRouter* pointer_watcher_event_router() { | 67 PointerWatcherEventRouter* pointer_watcher_event_router() { |
| 65 return pointer_watcher_event_router_.get(); | 68 return pointer_watcher_event_router_.get(); |
| 66 } | 69 } |
| 67 shell::Connector* connector() { return connector_; } | 70 shell::Connector* connector() { return connector_; } |
| 68 ui::GpuService* gpu_service() { return gpu_service_.get(); } | 71 ui::GpuService* gpu_service() { return gpu_service_.get(); } |
| 69 ui::WindowTreeClient* client() { return client_.get(); } | 72 ui::WindowTreeClient* client() { return client_.get(); } |
| 70 | 73 |
| 71 ui::Window* NewWindow( | 74 ui::Window* NewWindow( |
| 72 const std::map<std::string, std::vector<uint8_t>>& properties); | 75 const std::map<std::string, std::vector<uint8_t>>& properties); |
| 73 | 76 |
| 74 NativeWidget* CreateNativeWidgetMus( | 77 NativeWidget* CreateNativeWidgetMus( |
| 75 const std::map<std::string, std::vector<uint8_t>>& properties, | 78 const std::map<std::string, std::vector<uint8_t>>& properties, |
| 76 const Widget::InitParams& init_params, | 79 const Widget::InitParams& init_params, |
| 77 internal::NativeWidgetDelegate* delegate); | 80 internal::NativeWidgetDelegate* delegate); |
| 78 | 81 |
| 79 const std::set<ui::Window*>& GetRoots() const; | 82 const std::set<ui::Window*>& GetRoots() const; |
| 80 | 83 |
| 81 private: | 84 private: |
| 82 WindowManagerConnection(shell::Connector* connector, | 85 WindowManagerConnection( |
| 83 const shell::Identity& identity); | 86 shell::Connector* connector, |
| 87 const shell::Identity& identity, |
| 88 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 84 | 89 |
| 85 // ui::WindowTreeClientDelegate: | 90 // ui::WindowTreeClientDelegate: |
| 86 void OnEmbed(ui::Window* root) override; | 91 void OnEmbed(ui::Window* root) override; |
| 87 void OnDidDestroyClient(ui::WindowTreeClient* client) override; | 92 void OnDidDestroyClient(ui::WindowTreeClient* client) override; |
| 88 void OnPointerEventObserved(const ui::PointerEvent& event, | 93 void OnPointerEventObserved(const ui::PointerEvent& event, |
| 89 ui::Window* target) override; | 94 ui::Window* target) override; |
| 90 | 95 |
| 91 // ScreenMusDelegate: | 96 // ScreenMusDelegate: |
| 92 void OnWindowManagerFrameValuesChanged() override; | 97 void OnWindowManagerFrameValuesChanged() override; |
| 93 gfx::Point GetCursorScreenPoint() override; | 98 gfx::Point GetCursorScreenPoint() override; |
| 94 | 99 |
| 95 // ui:OSExchangeDataProviderFactory::Factory: | 100 // ui:OSExchangeDataProviderFactory::Factory: |
| 96 std::unique_ptr<OSExchangeData::Provider> BuildProvider() override; | 101 std::unique_ptr<OSExchangeData::Provider> BuildProvider() override; |
| 97 | 102 |
| 98 shell::Connector* connector_; | 103 shell::Connector* connector_; |
| 99 shell::Identity identity_; | 104 shell::Identity identity_; |
| 100 std::unique_ptr<ScreenMus> screen_; | 105 std::unique_ptr<ScreenMus> screen_; |
| 101 std::unique_ptr<ui::WindowTreeClient> client_; | 106 std::unique_ptr<ui::WindowTreeClient> client_; |
| 102 std::unique_ptr<ui::GpuService> gpu_service_; | 107 std::unique_ptr<ui::GpuService> gpu_service_; |
| 103 std::unique_ptr<PointerWatcherEventRouter> pointer_watcher_event_router_; | 108 std::unique_ptr<PointerWatcherEventRouter> pointer_watcher_event_router_; |
| 104 std::unique_ptr<SurfaceContextFactory> compositor_context_factory_; | 109 std::unique_ptr<SurfaceContextFactory> compositor_context_factory_; |
| 105 | 110 |
| 106 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); | 111 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); |
| 107 }; | 112 }; |
| 108 | 113 |
| 109 } // namespace views | 114 } // namespace views |
| 110 | 115 |
| 111 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ | 116 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ |
| OLD | NEW |