| 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/mojo_interface_factory.h" | 9 #include "ash/common/mojo_interface_factory.h" |
| 10 #include "ash/common/system/chromeos/power/power_status.h" | 10 #include "ash/common/system/chromeos/power/power_status.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // We may not have started the NetworkHandler. | 105 // We may not have started the NetworkHandler. |
| 106 if (chromeos::NetworkHandler::IsInitialized()) | 106 if (chromeos::NetworkHandler::IsInitialized()) |
| 107 chromeos::NetworkHandler::Shutdown(); | 107 chromeos::NetworkHandler::Shutdown(); |
| 108 device::BluetoothAdapterFactory::Shutdown(); | 108 device::BluetoothAdapterFactory::Shutdown(); |
| 109 bluez::BluezDBusManager::Shutdown(); | 109 bluez::BluezDBusManager::Shutdown(); |
| 110 chromeos::DBusThreadManager::Shutdown(); | 110 chromeos::DBusThreadManager::Shutdown(); |
| 111 message_center::MessageCenter::Shutdown(); | 111 message_center::MessageCenter::Shutdown(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void WindowManagerApplication::OnStart() { | 114 void WindowManagerApplication::OnStart() { |
| 115 mojo_interface_factory::RegisterInterfaces( |
| 116 ®istry_, base::ThreadTaskRunnerHandle::Get()); |
| 117 |
| 115 aura_init_ = base::MakeUnique<views::AuraInit>( | 118 aura_init_ = base::MakeUnique<views::AuraInit>( |
| 116 context()->connector(), context()->identity(), "ash_mus_resources.pak", | 119 context()->connector(), context()->identity(), "ash_mus_resources.pak", |
| 117 "ash_mus_resources_200.pak", nullptr, | 120 "ash_mus_resources_200.pak", nullptr, |
| 118 views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER); | 121 views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER); |
| 119 window_manager_ = | 122 window_manager_ = |
| 120 base::MakeUnique<WindowManager>(context()->connector(), Config::MASH); | 123 base::MakeUnique<WindowManager>(context()->connector(), Config::MASH); |
| 121 | 124 |
| 122 tracing_.Initialize(context()->connector(), context()->identity().name()); | 125 tracing_.Initialize(context()->connector(), context()->identity().name()); |
| 123 | 126 |
| 124 std::unique_ptr<aura::WindowTreeClient> window_tree_client = | 127 std::unique_ptr<aura::WindowTreeClient> window_tree_client = |
| 125 base::MakeUnique<aura::WindowTreeClient>( | 128 base::MakeUnique<aura::WindowTreeClient>( |
| 126 context()->connector(), window_manager_.get(), window_manager_.get()); | 129 context()->connector(), window_manager_.get(), window_manager_.get()); |
| 127 window_tree_client->ConnectAsWindowManager(); | 130 window_tree_client->ConnectAsWindowManager(); |
| 128 | 131 |
| 129 const size_t kMaxNumberThreads = 3u; // Matches that of content. | 132 const size_t kMaxNumberThreads = 3u; // Matches that of content. |
| 130 const char kThreadNamePrefix[] = "MashBlocking"; | 133 const char kThreadNamePrefix[] = "MashBlocking"; |
| 131 blocking_pool_ = new base::SequencedWorkerPool( | 134 blocking_pool_ = new base::SequencedWorkerPool( |
| 132 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); | 135 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); |
| 133 const bool init_network_handler = true; | 136 const bool init_network_handler = true; |
| 134 InitWindowManager(std::move(window_tree_client), blocking_pool_, | 137 InitWindowManager(std::move(window_tree_client), blocking_pool_, |
| 135 init_network_handler); | 138 init_network_handler); |
| 136 } | 139 } |
| 137 | 140 |
| 138 bool WindowManagerApplication::OnConnect( | 141 void WindowManagerApplication::OnBindInterface( |
| 139 const service_manager::ServiceInfo& remote_info, | 142 const service_manager::ServiceInfo& source_info, |
| 140 service_manager::InterfaceRegistry* registry) { | 143 const std::string& interface_name, |
| 141 // Register services used in both classic ash and mash. | 144 mojo::ScopedMessagePipeHandle interface_pipe) { |
| 142 mojo_interface_factory::RegisterInterfaces( | 145 registry_.BindInterface(source_info.identity, interface_name, |
| 143 registry, base::ThreadTaskRunnerHandle::Get()); | 146 std::move(interface_pipe)); |
| 144 return true; | |
| 145 } | 147 } |
| 146 | 148 |
| 147 } // namespace mus | 149 } // namespace mus |
| 148 } // namespace ash | 150 } // namespace ash |
| OLD | NEW |