| 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" |
| 11 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 12 #include "ash/mus/network_connect_delegate_mus.h" | 12 #include "ash/mus/network_connect_delegate_mus.h" |
| 13 #include "ash/mus/window_manager.h" | 13 #include "ash/mus/window_manager.h" |
| 14 #include "ash/public/cpp/config.h" |
| 14 #include "base/bind.h" | 15 #include "base/bind.h" |
| 15 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 16 #include "base/threading/sequenced_worker_pool.h" | 17 #include "base/threading/sequenced_worker_pool.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "chromeos/audio/cras_audio_handler.h" | 19 #include "chromeos/audio/cras_audio_handler.h" |
| 19 #include "chromeos/dbus/dbus_thread_manager.h" | 20 #include "chromeos/dbus/dbus_thread_manager.h" |
| 20 #include "chromeos/network/network_connect.h" | 21 #include "chromeos/network/network_connect.h" |
| 21 #include "chromeos/network/network_handler.h" | 22 #include "chromeos/network/network_handler.h" |
| 22 #include "chromeos/system/fake_statistics_provider.h" | 23 #include "chromeos/system/fake_statistics_provider.h" |
| 23 #include "device/bluetooth/bluetooth_adapter_factory.h" | 24 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 bluez::BluezDBusManager::Shutdown(); | 109 bluez::BluezDBusManager::Shutdown(); |
| 109 chromeos::DBusThreadManager::Shutdown(); | 110 chromeos::DBusThreadManager::Shutdown(); |
| 110 message_center::MessageCenter::Shutdown(); | 111 message_center::MessageCenter::Shutdown(); |
| 111 } | 112 } |
| 112 | 113 |
| 113 void WindowManagerApplication::OnStart() { | 114 void WindowManagerApplication::OnStart() { |
| 114 aura_init_ = base::MakeUnique<views::AuraInit>( | 115 aura_init_ = base::MakeUnique<views::AuraInit>( |
| 115 context()->connector(), context()->identity(), "ash_mus_resources.pak", | 116 context()->connector(), context()->identity(), "ash_mus_resources.pak", |
| 116 "ash_mus_resources_200.pak", nullptr, | 117 "ash_mus_resources_200.pak", nullptr, |
| 117 views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER); | 118 views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER); |
| 118 window_manager_.reset(new WindowManager(context()->connector())); | 119 window_manager_ = |
| 120 base::MakeUnique<WindowManager>(context()->connector(), Config::MASH); |
| 119 | 121 |
| 120 tracing_.Initialize(context()->connector(), context()->identity().name()); | 122 tracing_.Initialize(context()->connector(), context()->identity().name()); |
| 121 | 123 |
| 122 std::unique_ptr<aura::WindowTreeClient> window_tree_client = | 124 std::unique_ptr<aura::WindowTreeClient> window_tree_client = |
| 123 base::MakeUnique<aura::WindowTreeClient>( | 125 base::MakeUnique<aura::WindowTreeClient>( |
| 124 context()->connector(), window_manager_.get(), window_manager_.get()); | 126 context()->connector(), window_manager_.get(), window_manager_.get()); |
| 125 window_tree_client->ConnectAsWindowManager(); | 127 window_tree_client->ConnectAsWindowManager(); |
| 126 | 128 |
| 127 const size_t kMaxNumberThreads = 3u; // Matches that of content. | 129 const size_t kMaxNumberThreads = 3u; // Matches that of content. |
| 128 const char kThreadNamePrefix[] = "MashBlocking"; | 130 const char kThreadNamePrefix[] = "MashBlocking"; |
| 129 blocking_pool_ = new base::SequencedWorkerPool( | 131 blocking_pool_ = new base::SequencedWorkerPool( |
| 130 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); | 132 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); |
| 131 const bool init_network_handler = true; | 133 const bool init_network_handler = true; |
| 132 InitWindowManager(std::move(window_tree_client), blocking_pool_, | 134 InitWindowManager(std::move(window_tree_client), blocking_pool_, |
| 133 init_network_handler); | 135 init_network_handler); |
| 134 } | 136 } |
| 135 | 137 |
| 136 bool WindowManagerApplication::OnConnect( | 138 bool WindowManagerApplication::OnConnect( |
| 137 const service_manager::ServiceInfo& remote_info, | 139 const service_manager::ServiceInfo& remote_info, |
| 138 service_manager::InterfaceRegistry* registry) { | 140 service_manager::InterfaceRegistry* registry) { |
| 139 // Register services used in both classic ash and mash. | 141 // Register services used in both classic ash and mash. |
| 140 mojo_interface_factory::RegisterInterfaces( | 142 mojo_interface_factory::RegisterInterfaces( |
| 141 registry, base::ThreadTaskRunnerHandle::Get()); | 143 registry, base::ThreadTaskRunnerHandle::Get()); |
| 142 return true; | 144 return true; |
| 143 } | 145 } |
| 144 | 146 |
| 145 } // namespace mus | 147 } // namespace mus |
| 146 } // namespace ash | 148 } // namespace ash |
| OLD | NEW |