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_application.h" | 5 #include "ash/mus/window_manager_application.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
10 #include "ash/mus/accelerators/accelerator_registrar_impl.h" | 10 #include "ash/mus/accelerators/accelerator_registrar_impl.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 chromeos::CrasAudioHandler::Shutdown(); | 58 chromeos::CrasAudioHandler::Shutdown(); |
59 bluez::BluezDBusManager::Shutdown(); | 59 bluez::BluezDBusManager::Shutdown(); |
60 chromeos::DBusThreadManager::Shutdown(); | 60 chromeos::DBusThreadManager::Shutdown(); |
61 #endif | 61 #endif |
62 message_center::MessageCenter::Shutdown(); | 62 message_center::MessageCenter::Shutdown(); |
63 } | 63 } |
64 | 64 |
65 } // namespace | 65 } // namespace |
66 | 66 |
67 WindowManagerApplication::WindowManagerApplication() | 67 WindowManagerApplication::WindowManagerApplication() |
68 : connector_(nullptr), screenlock_state_listener_binding_(this) {} | 68 : screenlock_state_listener_binding_(this) {} |
69 | 69 |
70 WindowManagerApplication::~WindowManagerApplication() { | 70 WindowManagerApplication::~WindowManagerApplication() { |
71 // AcceleratorRegistrarImpl removes an observer in its destructor. Destroy | 71 // AcceleratorRegistrarImpl removes an observer in its destructor. Destroy |
72 // it early on. | 72 // it early on. |
73 std::set<AcceleratorRegistrarImpl*> accelerator_registrars( | 73 std::set<AcceleratorRegistrarImpl*> accelerator_registrars( |
74 accelerator_registrars_); | 74 accelerator_registrars_); |
75 for (AcceleratorRegistrarImpl* registrar : accelerator_registrars) | 75 for (AcceleratorRegistrarImpl* registrar : accelerator_registrars) |
76 registrar->Destroy(); | 76 registrar->Destroy(); |
77 | 77 |
78 // Destroy the WindowManager while still valid. This way we ensure | 78 // Destroy the WindowManager while still valid. This way we ensure |
79 // OnWillDestroyRootWindowController() is called (if it hasn't been already). | 79 // OnWillDestroyRootWindowController() is called (if it hasn't been already). |
80 window_manager_.reset(); | 80 window_manager_.reset(); |
81 | 81 |
82 ShutdownComponents(); | 82 ShutdownComponents(); |
83 } | 83 } |
84 | 84 |
85 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( | 85 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( |
86 AcceleratorRegistrarImpl* registrar) { | 86 AcceleratorRegistrarImpl* registrar) { |
87 accelerator_registrars_.erase(registrar); | 87 accelerator_registrars_.erase(registrar); |
88 } | 88 } |
89 | 89 |
90 void WindowManagerApplication::InitWindowManager( | 90 void WindowManagerApplication::InitWindowManager( |
91 ::ui::WindowTreeClient* window_tree_client) { | 91 ::ui::WindowTreeClient* window_tree_client) { |
92 InitializeComponents(); | 92 InitializeComponents(); |
93 | 93 |
94 window_manager_->Init(window_tree_client); | 94 window_manager_->Init(window_tree_client); |
95 window_manager_->AddObserver(this); | 95 window_manager_->AddObserver(this); |
96 } | 96 } |
97 | 97 |
98 void WindowManagerApplication::OnStart(shell::Connector* connector, | 98 void WindowManagerApplication::OnStart(const shell::Identity& identity) { |
99 const shell::Identity& identity, | 99 ::ui::GpuService::Initialize(connector()); |
100 uint32_t id) { | 100 window_manager_.reset(new WindowManager(connector())); |
101 connector_ = connector; | |
102 ::ui::GpuService::Initialize(connector); | |
103 window_manager_.reset(new WindowManager(connector_)); | |
104 | 101 |
105 aura_init_.reset(new views::AuraInit(connector_, "ash_mus_resources.pak")); | 102 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak")); |
106 MaterialDesignController::Initialize(); | 103 MaterialDesignController::Initialize(); |
107 | 104 |
108 tracing_.Initialize(connector, identity.name()); | 105 tracing_.Initialize(connector(), identity.name()); |
109 | 106 |
110 ::ui::WindowTreeClient* window_tree_client = new ::ui::WindowTreeClient( | 107 ::ui::WindowTreeClient* window_tree_client = new ::ui::WindowTreeClient( |
111 window_manager_.get(), window_manager_.get(), nullptr); | 108 window_manager_.get(), window_manager_.get(), nullptr); |
112 window_tree_client->ConnectAsWindowManager(connector); | 109 window_tree_client->ConnectAsWindowManager(connector()); |
113 | 110 |
114 InitWindowManager(window_tree_client); | 111 InitWindowManager(window_tree_client); |
115 } | 112 } |
116 | 113 |
117 bool WindowManagerApplication::OnConnect(shell::Connection* connection) { | 114 bool WindowManagerApplication::OnConnect(shell::Connection* connection) { |
118 connection->AddInterface<mojom::ShelfLayout>(this); | 115 connection->AddInterface<mojom::ShelfLayout>(this); |
119 connection->AddInterface<mojom::UserWindowController>(this); | 116 connection->AddInterface<mojom::UserWindowController>(this); |
120 connection->AddInterface<::ui::mojom::AcceleratorRegistrar>(this); | 117 connection->AddInterface<::ui::mojom::AcceleratorRegistrar>(this); |
121 if (connection->GetRemoteIdentity().name() == "mojo:mash_session") { | 118 if (connection->GetRemoteIdentity().name() == "mojo:mash_session") { |
122 connection->GetInterface(&session_); | 119 connection->GetInterface(&session_); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 RootWindowController* controller) { | 198 RootWindowController* controller) { |
202 // TODO(msw): this isn't right, ownership should belong in WindowManager | 199 // TODO(msw): this isn't right, ownership should belong in WindowManager |
203 // and/or RootWindowController. But this is temporary until we get rid of | 200 // and/or RootWindowController. But this is temporary until we get rid of |
204 // sysui. | 201 // sysui. |
205 shelf_layout_.reset(); | 202 shelf_layout_.reset(); |
206 user_window_controller_.reset(); | 203 user_window_controller_.reset(); |
207 } | 204 } |
208 | 205 |
209 } // namespace mus | 206 } // namespace mus |
210 } // namespace ash | 207 } // namespace ash |
OLD | NEW |