| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "services/service_manager/public/cpp/identity.h" | 17 #include "services/service_manager/public/cpp/identity.h" |
| 18 #include "services/ui/public/cpp/window_tree_client_delegate.h" | 18 #include "services/ui/public/cpp/window_tree_client_delegate.h" |
| 19 #include "ui/base/dragdrop/os_exchange_data_provider_factory.h" | 19 #include "ui/base/dragdrop/os_exchange_data_provider_factory.h" |
| 20 #include "ui/views/mus/mus_export.h" | 20 #include "ui/views/mus/mus_export.h" |
| 21 #include "ui/views/mus/screen_mus_delegate.h" | 21 #include "ui/views/mus/screen_mus_delegate.h" |
| 22 #include "ui/views/widget/widget.h" | 22 #include "ui/views/widget/widget.h" |
| 23 | 23 |
| 24 namespace shell { | 24 namespace service_manager { |
| 25 class Connector; | 25 class Connector; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace ui { | 28 namespace ui { |
| 29 class GpuService; | 29 class GpuService; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace views { | 32 namespace views { |
| 33 class ClipboardMus; | 33 class ClipboardMus; |
| 34 class NativeWidget; | 34 class NativeWidget; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 56 class VIEWS_MUS_EXPORT WindowManagerConnection | 56 class VIEWS_MUS_EXPORT WindowManagerConnection |
| 57 : public NON_EXPORTED_BASE(ui::WindowTreeClientDelegate), | 57 : public NON_EXPORTED_BASE(ui::WindowTreeClientDelegate), |
| 58 public ScreenMusDelegate, | 58 public ScreenMusDelegate, |
| 59 public ui::OSExchangeDataProviderFactory::Factory { | 59 public ui::OSExchangeDataProviderFactory::Factory { |
| 60 public: | 60 public: |
| 61 ~WindowManagerConnection() override; | 61 ~WindowManagerConnection() override; |
| 62 | 62 |
| 63 // |io_task_runner| is used by the gpu service. If no task runner is provided, | 63 // |io_task_runner| is used by the gpu service. If no task runner is provided, |
| 64 // then a new thread is created and used by ui::GpuService. | 64 // then a new thread is created and used by ui::GpuService. |
| 65 static std::unique_ptr<WindowManagerConnection> Create( | 65 static std::unique_ptr<WindowManagerConnection> Create( |
| 66 shell::Connector* connector, | 66 service_manager::Connector* connector, |
| 67 const shell::Identity& identity, | 67 const service_manager::Identity& identity, |
| 68 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr); | 68 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr); |
| 69 static WindowManagerConnection* Get(); | 69 static WindowManagerConnection* Get(); |
| 70 static bool Exists(); | 70 static bool Exists(); |
| 71 | 71 |
| 72 PointerWatcherEventRouter* pointer_watcher_event_router() { | 72 PointerWatcherEventRouter* pointer_watcher_event_router() { |
| 73 return pointer_watcher_event_router_.get(); | 73 return pointer_watcher_event_router_.get(); |
| 74 } | 74 } |
| 75 shell::Connector* connector() { return connector_; } | 75 service_manager::Connector* connector() { return connector_; } |
| 76 ui::GpuService* gpu_service() { return gpu_service_.get(); } | 76 ui::GpuService* gpu_service() { return gpu_service_.get(); } |
| 77 ui::WindowTreeClient* client() { return client_.get(); } | 77 ui::WindowTreeClient* client() { return client_.get(); } |
| 78 | 78 |
| 79 ui::Window* NewTopLevelWindow( | 79 ui::Window* NewTopLevelWindow( |
| 80 const std::map<std::string, std::vector<uint8_t>>& properties); | 80 const std::map<std::string, std::vector<uint8_t>>& properties); |
| 81 | 81 |
| 82 NativeWidget* CreateNativeWidgetMus( | 82 NativeWidget* CreateNativeWidgetMus( |
| 83 const std::map<std::string, std::vector<uint8_t>>& properties, | 83 const std::map<std::string, std::vector<uint8_t>>& properties, |
| 84 const Widget::InitParams& init_params, | 84 const Widget::InitParams& init_params, |
| 85 internal::NativeWidgetDelegate* delegate); | 85 internal::NativeWidgetDelegate* delegate); |
| 86 | 86 |
| 87 const std::set<ui::Window*>& GetRoots() const; | 87 const std::set<ui::Window*>& GetRoots() const; |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 friend class test::WindowManagerConnectionTestApi; | 90 friend class test::WindowManagerConnectionTestApi; |
| 91 | 91 |
| 92 WindowManagerConnection( | 92 WindowManagerConnection( |
| 93 shell::Connector* connector, | 93 service_manager::Connector* connector, |
| 94 const shell::Identity& identity, | 94 const service_manager::Identity& identity, |
| 95 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 95 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 96 | 96 |
| 97 // ui::WindowTreeClientDelegate: | 97 // ui::WindowTreeClientDelegate: |
| 98 void OnEmbed(ui::Window* root) override; | 98 void OnEmbed(ui::Window* root) override; |
| 99 void OnLostConnection(ui::WindowTreeClient* client) override; | 99 void OnLostConnection(ui::WindowTreeClient* client) override; |
| 100 void OnEmbedRootDestroyed(ui::Window* root) override; | 100 void OnEmbedRootDestroyed(ui::Window* root) override; |
| 101 void OnPointerEventObserved(const ui::PointerEvent& event, | 101 void OnPointerEventObserved(const ui::PointerEvent& event, |
| 102 ui::Window* target) override; | 102 ui::Window* target) override; |
| 103 | 103 |
| 104 // ScreenMusDelegate: | 104 // ScreenMusDelegate: |
| 105 void OnWindowManagerFrameValuesChanged() override; | 105 void OnWindowManagerFrameValuesChanged() override; |
| 106 gfx::Point GetCursorScreenPoint() override; | 106 gfx::Point GetCursorScreenPoint() override; |
| 107 ui::Window* GetWindowAtScreenPoint(const gfx::Point& point) override; | 107 ui::Window* GetWindowAtScreenPoint(const gfx::Point& point) override; |
| 108 | 108 |
| 109 // ui:OSExchangeDataProviderFactory::Factory: | 109 // ui:OSExchangeDataProviderFactory::Factory: |
| 110 std::unique_ptr<OSExchangeData::Provider> BuildProvider() override; | 110 std::unique_ptr<OSExchangeData::Provider> BuildProvider() override; |
| 111 | 111 |
| 112 shell::Connector* connector_; | 112 service_manager::Connector* connector_; |
| 113 shell::Identity identity_; | 113 service_manager::Identity identity_; |
| 114 std::unique_ptr<ScreenMus> screen_; | 114 std::unique_ptr<ScreenMus> screen_; |
| 115 std::unique_ptr<ui::WindowTreeClient> client_; | 115 std::unique_ptr<ui::WindowTreeClient> client_; |
| 116 std::unique_ptr<ui::GpuService> gpu_service_; | 116 std::unique_ptr<ui::GpuService> gpu_service_; |
| 117 std::unique_ptr<PointerWatcherEventRouter> pointer_watcher_event_router_; | 117 std::unique_ptr<PointerWatcherEventRouter> pointer_watcher_event_router_; |
| 118 std::unique_ptr<SurfaceContextFactory> compositor_context_factory_; | 118 std::unique_ptr<SurfaceContextFactory> compositor_context_factory_; |
| 119 | 119 |
| 120 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); | 120 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 } // namespace views | 123 } // namespace views |
| 124 | 124 |
| 125 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ | 125 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ |
| OLD | NEW |