| 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 #include "ash/mus/window_manager.h" | 5 #include "ash/mus/window_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "ash/mus/window_manager_observer.h" | 24 #include "ash/mus/window_manager_observer.h" |
| 25 #include "ash/public/cpp/shell_window_ids.h" | 25 #include "ash/public/cpp/shell_window_ids.h" |
| 26 #include "base/memory/ptr_util.h" | 26 #include "base/memory/ptr_util.h" |
| 27 #include "services/service_manager/public/cpp/connector.h" | 27 #include "services/service_manager/public/cpp/connector.h" |
| 28 #include "services/ui/common/event_matcher_util.h" | 28 #include "services/ui/common/event_matcher_util.h" |
| 29 #include "services/ui/common/types.h" | 29 #include "services/ui/common/types.h" |
| 30 #include "services/ui/public/cpp/property_type_converters.h" | 30 #include "services/ui/public/cpp/property_type_converters.h" |
| 31 #include "services/ui/public/cpp/window.h" | 31 #include "services/ui/public/cpp/window.h" |
| 32 #include "services/ui/public/cpp/window_property.h" | 32 #include "services/ui/public/cpp/window_property.h" |
| 33 #include "services/ui/public/cpp/window_tree_client.h" | 33 #include "services/ui/public/cpp/window_tree_client.h" |
| 34 #include "services/ui/public/interfaces/constants.mojom.h" |
| 34 #include "services/ui/public/interfaces/mus_constants.mojom.h" | 35 #include "services/ui/public/interfaces/mus_constants.mojom.h" |
| 35 #include "services/ui/public/interfaces/window_manager.mojom.h" | 36 #include "services/ui/public/interfaces/window_manager.mojom.h" |
| 36 #include "ui/base/hit_test.h" | 37 #include "ui/base/hit_test.h" |
| 37 #include "ui/display/display_observer.h" | 38 #include "ui/display/display_observer.h" |
| 38 #include "ui/events/mojo/event.mojom.h" | 39 #include "ui/events/mojo/event.mojom.h" |
| 39 #include "ui/views/mus/pointer_watcher_event_router.h" | 40 #include "ui/views/mus/pointer_watcher_event_router.h" |
| 40 #include "ui/views/mus/screen_mus.h" | 41 #include "ui/views/mus/screen_mus.h" |
| 41 | 42 |
| 42 namespace ash { | 43 namespace ash { |
| 43 namespace mus { | 44 namespace mus { |
| 44 | 45 |
| 45 WindowManager::WindowManager(service_manager::Connector* connector) | 46 WindowManager::WindowManager(service_manager::Connector* connector) |
| 46 : connector_(connector) {} | 47 : connector_(connector) {} |
| 47 | 48 |
| 48 WindowManager::~WindowManager() { | 49 WindowManager::~WindowManager() { |
| 49 Shutdown(); | 50 Shutdown(); |
| 50 } | 51 } |
| 51 | 52 |
| 52 void WindowManager::Init( | 53 void WindowManager::Init( |
| 53 std::unique_ptr<ui::WindowTreeClient> window_tree_client, | 54 std::unique_ptr<ui::WindowTreeClient> window_tree_client, |
| 54 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool) { | 55 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool) { |
| 55 DCHECK(!window_tree_client_); | 56 DCHECK(!window_tree_client_); |
| 56 window_tree_client_ = std::move(window_tree_client); | 57 window_tree_client_ = std::move(window_tree_client); |
| 57 | 58 |
| 58 // |connector_| will be null in some tests. | 59 // |connector_| will be null in some tests. |
| 59 if (connector_) | 60 if (connector_) { |
| 60 connector_->ConnectToInterface("ui", &display_controller_); | 61 connector_->ConnectToInterface(ui::mojom::kServiceName, |
| 62 &display_controller_); |
| 63 } |
| 61 | 64 |
| 62 screen_ = base::MakeUnique<display::ScreenBase>(); | 65 screen_ = base::MakeUnique<display::ScreenBase>(); |
| 63 display::Screen::SetScreenInstance(screen_.get()); | 66 display::Screen::SetScreenInstance(screen_.get()); |
| 64 | 67 |
| 65 pointer_watcher_event_router_.reset( | 68 pointer_watcher_event_router_.reset( |
| 66 new views::PointerWatcherEventRouter(window_tree_client_.get())); | 69 new views::PointerWatcherEventRouter(window_tree_client_.get())); |
| 67 | 70 |
| 68 shadow_controller_.reset(new ShadowController(window_tree_client_.get())); | 71 shadow_controller_.reset(new ShadowController(window_tree_client_.get())); |
| 69 | 72 |
| 70 // The insets are roughly what is needed by CustomFrameView. The expectation | 73 // The insets are roughly what is needed by CustomFrameView. The expectation |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 const ui::Event& event) { | 392 const ui::Event& event) { |
| 390 auto iter = accelerator_handlers_.find(GetAcceleratorNamespaceId(id)); | 393 auto iter = accelerator_handlers_.find(GetAcceleratorNamespaceId(id)); |
| 391 if (iter == accelerator_handlers_.end()) | 394 if (iter == accelerator_handlers_.end()) |
| 392 return ui::mojom::EventResult::HANDLED; | 395 return ui::mojom::EventResult::HANDLED; |
| 393 | 396 |
| 394 return iter->second->OnAccelerator(id, event); | 397 return iter->second->OnAccelerator(id, event); |
| 395 } | 398 } |
| 396 | 399 |
| 397 } // namespace mus | 400 } // namespace mus |
| 398 } // namespace ash | 401 } // namespace ash |
| OLD | NEW |