| 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/mojo_interface_factory.h" | 9 #include "ash/mojo_interface_factory.h" |
| 10 #include "ash/mus/network_connect_delegate_mus.h" | 10 #include "ash/mus/network_connect_delegate_mus.h" |
| 11 #include "ash/mus/window_manager.h" | 11 #include "ash/mus/window_manager.h" |
| 12 #include "ash/public/cpp/config.h" | 12 #include "ash/public/cpp/config.h" |
| 13 #include "ash/shell_delegate.h" | 13 #include "ash/shell_delegate.h" |
| 14 #include "ash/system/power/power_status.h" | 14 #include "ash/system/power/power_status.h" |
| 15 #include "base/bind.h" | 15 #include "base/bind.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/threading/sequenced_worker_pool.h" | 17 #include "base/threading/sequenced_worker_pool.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "chromeos/audio/cras_audio_handler.h" | 19 #include "chromeos/audio/cras_audio_handler.h" |
| 20 #include "chromeos/dbus/dbus_thread_manager.h" | 20 #include "chromeos/dbus/dbus_thread_manager.h" |
| 21 #include "chromeos/network/network_connect.h" | 21 #include "chromeos/network/network_connect.h" |
| 22 #include "chromeos/network/network_handler.h" | 22 #include "chromeos/network/network_handler.h" |
| 23 #include "chromeos/system/fake_statistics_provider.h" | 23 #include "chromeos/system/fake_statistics_provider.h" |
| 24 #include "device/bluetooth/bluetooth_adapter_factory.h" | 24 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 25 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 25 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 26 #include "services/service_manager/public/cpp/connector.h" | 26 #include "services/service_manager/public/cpp/connector.h" |
| 27 #include "services/service_manager/public/cpp/service_context.h" | 27 #include "services/service_manager/public/cpp/service_context.h" |
| 28 #include "services/tracing/public/cpp/provider.h" | |
| 29 #include "services/ui/common/accelerator_util.h" | 28 #include "services/ui/common/accelerator_util.h" |
| 30 #include "ui/aura/env.h" | 29 #include "ui/aura/env.h" |
| 31 #include "ui/aura/mus/window_tree_client.h" | 30 #include "ui/aura/mus/window_tree_client.h" |
| 32 #include "ui/events/event.h" | 31 #include "ui/events/event.h" |
| 33 #include "ui/message_center/message_center.h" | 32 #include "ui/message_center/message_center.h" |
| 34 #include "ui/views/mus/aura_init.h" | 33 #include "ui/views/mus/aura_init.h" |
| 35 | 34 |
| 36 namespace ash { | 35 namespace ash { |
| 37 namespace mus { | 36 namespace mus { |
| 38 | 37 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 mojo_interface_factory::RegisterInterfaces( | 129 mojo_interface_factory::RegisterInterfaces( |
| 131 ®istry_, base::ThreadTaskRunnerHandle::Get()); | 130 ®istry_, base::ThreadTaskRunnerHandle::Get()); |
| 132 | 131 |
| 133 aura_init_ = base::MakeUnique<views::AuraInit>( | 132 aura_init_ = base::MakeUnique<views::AuraInit>( |
| 134 context()->connector(), context()->identity(), "ash_mus_resources.pak", | 133 context()->connector(), context()->identity(), "ash_mus_resources.pak", |
| 135 "ash_mus_resources_200.pak", nullptr, | 134 "ash_mus_resources_200.pak", nullptr, |
| 136 views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER); | 135 views::AuraInit::Mode::AURA_MUS_WINDOW_MANAGER); |
| 137 window_manager_ = base::MakeUnique<WindowManager>( | 136 window_manager_ = base::MakeUnique<WindowManager>( |
| 138 context()->connector(), ash_config_, show_primary_host_on_connect_); | 137 context()->connector(), ash_config_, show_primary_host_on_connect_); |
| 139 | 138 |
| 140 tracing_.Initialize(context()->connector(), context()->identity().name()); | |
| 141 | |
| 142 std::unique_ptr<aura::WindowTreeClient> window_tree_client = | 139 std::unique_ptr<aura::WindowTreeClient> window_tree_client = |
| 143 base::MakeUnique<aura::WindowTreeClient>( | 140 base::MakeUnique<aura::WindowTreeClient>( |
| 144 context()->connector(), window_manager_.get(), window_manager_.get()); | 141 context()->connector(), window_manager_.get(), window_manager_.get()); |
| 145 const bool automatically_create_display_roots = | 142 const bool automatically_create_display_roots = |
| 146 window_manager_->config() == Config::MASH; | 143 window_manager_->config() == Config::MASH; |
| 147 window_tree_client->ConnectAsWindowManager( | 144 window_tree_client->ConnectAsWindowManager( |
| 148 automatically_create_display_roots); | 145 automatically_create_display_roots); |
| 149 | 146 |
| 150 const size_t kMaxNumberThreads = 3u; // Matches that of content. | 147 const size_t kMaxNumberThreads = 3u; // Matches that of content. |
| 151 const char kThreadNamePrefix[] = "MashBlocking"; | 148 const char kThreadNamePrefix[] = "MashBlocking"; |
| 152 blocking_pool_ = new base::SequencedWorkerPool( | 149 blocking_pool_ = new base::SequencedWorkerPool( |
| 153 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); | 150 kMaxNumberThreads, kThreadNamePrefix, base::TaskPriority::USER_VISIBLE); |
| 154 const bool init_network_handler = true; | 151 const bool init_network_handler = true; |
| 155 InitWindowManager(std::move(window_tree_client), blocking_pool_, | 152 InitWindowManager(std::move(window_tree_client), blocking_pool_, |
| 156 init_network_handler); | 153 init_network_handler); |
| 157 } | 154 } |
| 158 | 155 |
| 159 void WindowManagerApplication::OnBindInterface( | 156 void WindowManagerApplication::OnBindInterface( |
| 160 const service_manager::ServiceInfo& source_info, | 157 const service_manager::ServiceInfo& source_info, |
| 161 const std::string& interface_name, | 158 const std::string& interface_name, |
| 162 mojo::ScopedMessagePipeHandle interface_pipe) { | 159 mojo::ScopedMessagePipeHandle interface_pipe) { |
| 163 registry_.BindInterface(source_info.identity, interface_name, | 160 registry_.BindInterface(source_info.identity, interface_name, |
| 164 std::move(interface_pipe)); | 161 std::move(interface_pipe)); |
| 165 } | 162 } |
| 166 | 163 |
| 167 } // namespace mus | 164 } // namespace mus |
| 168 } // namespace ash | 165 } // namespace ash |
| OLD | NEW |