| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 namespace mus { | 67 namespace mus { |
| 68 | 68 |
| 69 WindowManager::WindowManager(shell::Connector* connector) | 69 WindowManager::WindowManager(shell::Connector* connector) |
| 70 : connector_(connector) {} | 70 : connector_(connector) {} |
| 71 | 71 |
| 72 WindowManager::~WindowManager() { | 72 WindowManager::~WindowManager() { |
| 73 Shutdown(); | 73 Shutdown(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void WindowManager::Init( | 76 void WindowManager::Init( |
| 77 std::unique_ptr<ui::WindowTreeClient> window_tree_client) { | 77 std::unique_ptr<ui::WindowTreeClient> window_tree_client, |
| 78 const scoped_refptr<base::SequencedWorkerPool>& blocking_pool) { |
| 78 DCHECK(!window_tree_client_); | 79 DCHECK(!window_tree_client_); |
| 79 window_tree_client_ = std::move(window_tree_client); | 80 window_tree_client_ = std::move(window_tree_client); |
| 80 | 81 |
| 81 pointer_watcher_event_router_.reset( | 82 pointer_watcher_event_router_.reset( |
| 82 new views::PointerWatcherEventRouter(window_tree_client_.get())); | 83 new views::PointerWatcherEventRouter(window_tree_client_.get())); |
| 83 | 84 |
| 84 shadow_controller_.reset(new ShadowController(window_tree_client_.get())); | 85 shadow_controller_.reset(new ShadowController(window_tree_client_.get())); |
| 85 | 86 |
| 86 // The insets are roughly what is needed by CustomFrameView. The expectation | 87 // The insets are roughly what is needed by CustomFrameView. The expectation |
| 87 // is at some point we'll write our own NonClientFrameView and get the insets | 88 // is at some point we'll write our own NonClientFrameView and get the insets |
| 88 // from it. | 89 // from it. |
| 89 ui::mojom::FrameDecorationValuesPtr frame_decoration_values = | 90 ui::mojom::FrameDecorationValuesPtr frame_decoration_values = |
| 90 ui::mojom::FrameDecorationValues::New(); | 91 ui::mojom::FrameDecorationValues::New(); |
| 91 const gfx::Insets client_area_insets = | 92 const gfx::Insets client_area_insets = |
| 92 NonClientFrameController::GetPreferredClientAreaInsets(); | 93 NonClientFrameController::GetPreferredClientAreaInsets(); |
| 93 frame_decoration_values->normal_client_area_insets = client_area_insets; | 94 frame_decoration_values->normal_client_area_insets = client_area_insets; |
| 94 frame_decoration_values->maximized_client_area_insets = client_area_insets; | 95 frame_decoration_values->maximized_client_area_insets = client_area_insets; |
| 95 frame_decoration_values->max_title_bar_button_width = | 96 frame_decoration_values->max_title_bar_button_width = |
| 96 NonClientFrameController::GetMaxTitleBarButtonWidth(); | 97 NonClientFrameController::GetMaxTitleBarButtonWidth(); |
| 97 window_manager_client_->SetFrameDecorationValues( | 98 window_manager_client_->SetFrameDecorationValues( |
| 98 std::move(frame_decoration_values)); | 99 std::move(frame_decoration_values)); |
| 99 | 100 |
| 100 std::unique_ptr<ShellDelegate> shell_delegate(new ShellDelegateMus( | 101 std::unique_ptr<ShellDelegate> shell_delegate(new ShellDelegateMus( |
| 101 base::MakeUnique<AppListPresenterStub>(), connector_)); | 102 base::MakeUnique<AppListPresenterStub>(), connector_)); |
| 102 shell_.reset(new WmShellMus(std::move(shell_delegate), this, | 103 shell_.reset(new WmShellMus(std::move(shell_delegate), this, |
| 103 pointer_watcher_event_router_.get())); | 104 pointer_watcher_event_router_.get())); |
| 104 shell_->Initialize(); | 105 shell_->Initialize(blocking_pool); |
| 105 lookup_.reset(new WmLookupMus); | 106 lookup_.reset(new WmLookupMus); |
| 106 } | 107 } |
| 107 | 108 |
| 108 void WindowManager::SetScreenLocked(bool is_locked) { | 109 void WindowManager::SetScreenLocked(bool is_locked) { |
| 109 // TODO: screen locked state needs to be persisted for newly added displays. | 110 // TODO: screen locked state needs to be persisted for newly added displays. |
| 110 for (auto& root_window_controller : root_window_controllers_) { | 111 for (auto& root_window_controller : root_window_controllers_) { |
| 111 WmWindowMus* non_lock_screen_containers_container = | 112 WmWindowMus* non_lock_screen_containers_container = |
| 112 root_window_controller->GetWindowByShellWindowId( | 113 root_window_controller->GetWindowByShellWindowId( |
| 113 kShellWindowId_NonLockScreenContainersContainer); | 114 kShellWindowId_NonLockScreenContainersContainer); |
| 114 non_lock_screen_containers_container->mus_window()->SetVisible(!is_locked); | 115 non_lock_screen_containers_container->mus_window()->SetVisible(!is_locked); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 const ui::Event& event) { | 324 const ui::Event& event) { |
| 324 auto iter = accelerator_handlers_.find(GetAcceleratorNamespaceId(id)); | 325 auto iter = accelerator_handlers_.find(GetAcceleratorNamespaceId(id)); |
| 325 if (iter == accelerator_handlers_.end()) | 326 if (iter == accelerator_handlers_.end()) |
| 326 return ui::mojom::EventResult::HANDLED; | 327 return ui::mojom::EventResult::HANDLED; |
| 327 | 328 |
| 328 return iter->second->OnAccelerator(id, event); | 329 return iter->second->OnAccelerator(id, event); |
| 329 } | 330 } |
| 330 | 331 |
| 331 } // namespace mus | 332 } // namespace mus |
| 332 } // namespace ash | 333 } // namespace ash |
| OLD | NEW |