| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/sysui/sysui_application.h" | 5 #include "ash/sysui/sysui_application.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "ash/sysui/keyboard_ui_mus.h" | 24 #include "ash/sysui/keyboard_ui_mus.h" |
| 25 #include "ash/sysui/shelf_delegate_mus.h" | 25 #include "ash/sysui/shelf_delegate_mus.h" |
| 26 #include "ash/sysui/shell_delegate_mus.h" | 26 #include "ash/sysui/shell_delegate_mus.h" |
| 27 #include "ash/sysui/stub_context_factory.h" | 27 #include "ash/sysui/stub_context_factory.h" |
| 28 #include "ash/sysui/user_wallpaper_delegate_mus.h" | 28 #include "ash/sysui/user_wallpaper_delegate_mus.h" |
| 29 #include "base/bind.h" | 29 #include "base/bind.h" |
| 30 #include "base/files/file_path.h" | 30 #include "base/files/file_path.h" |
| 31 #include "base/path_service.h" | 31 #include "base/path_service.h" |
| 32 #include "base/threading/sequenced_worker_pool.h" | 32 #include "base/threading/sequenced_worker_pool.h" |
| 33 #include "components/mus/public/cpp/property_type_converters.h" | 33 #include "components/mus/public/cpp/property_type_converters.h" |
| 34 #include "components/mus/public/interfaces/input_devices/input_device_server.moj
om.h" |
| 34 #include "services/catalog/public/cpp/resource_loader.h" | 35 #include "services/catalog/public/cpp/resource_loader.h" |
| 35 #include "services/shell/public/cpp/connector.h" | 36 #include "services/shell/public/cpp/connector.h" |
| 36 #include "ui/aura/env.h" | 37 #include "ui/aura/env.h" |
| 37 #include "ui/base/resource/resource_bundle.h" | 38 #include "ui/base/resource/resource_bundle.h" |
| 38 #include "ui/base/ui_base_paths.h" | 39 #include "ui/base/ui_base_paths.h" |
| 39 #include "ui/display/display.h" | 40 #include "ui/display/display.h" |
| 40 #include "ui/display/screen.h" | 41 #include "ui/display/screen.h" |
| 41 #include "ui/message_center/message_center.h" | 42 #include "ui/message_center/message_center.h" |
| 42 #include "ui/platform_window/stub/stub_window.h" | 43 #include "ui/platform_window/stub/stub_window.h" |
| 43 #include "ui/views/mus/aura_init.h" | 44 #include "ui/views/mus/aura_init.h" |
| 44 #include "ui/views/mus/native_widget_mus.h" | 45 #include "ui/views/mus/native_widget_mus.h" |
| 45 #include "ui/views/mus/window_manager_connection.h" | 46 #include "ui/views/mus/window_manager_connection.h" |
| 46 #include "ui/views/views_delegate.h" | 47 #include "ui/views/views_delegate.h" |
| 47 | 48 |
| 48 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
| 49 #include "chromeos/audio/cras_audio_handler.h" | 50 #include "chromeos/audio/cras_audio_handler.h" |
| 50 #include "chromeos/dbus/dbus_thread_manager.h" | 51 #include "chromeos/dbus/dbus_thread_manager.h" |
| 51 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 52 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 52 #include "ui/events/devices/device_data_manager.h" | |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 using views::ViewsDelegate; | 55 using views::ViewsDelegate; |
| 56 | 56 |
| 57 namespace ash { | 57 namespace ash { |
| 58 namespace sysui { | 58 namespace sysui { |
| 59 | 59 |
| 60 namespace { | 60 namespace { |
| 61 | 61 |
| 62 const char kResourceFileStrings[] = "ash_resources_strings.pak"; | 62 const char kResourceFileStrings[] = "ash_resources_strings.pak"; |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile100), | 279 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile100), |
| 280 ui::SCALE_FACTOR_100P); | 280 ui::SCALE_FACTOR_100P); |
| 281 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile200), | 281 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile200), |
| 282 ui::SCALE_FACTOR_200P); | 282 ui::SCALE_FACTOR_200P); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void InitializeComponents() { | 285 void InitializeComponents() { |
| 286 message_center::MessageCenter::Initialize(); | 286 message_center::MessageCenter::Initialize(); |
| 287 | 287 |
| 288 #if defined(OS_CHROMEOS) | 288 #if defined(OS_CHROMEOS) |
| 289 ui::DeviceDataManager::CreateInstance(); | |
| 290 chromeos::DBusThreadManager::Initialize(); | 289 chromeos::DBusThreadManager::Initialize(); |
| 291 bluez::BluezDBusManager::Initialize( | 290 bluez::BluezDBusManager::Initialize( |
| 292 chromeos::DBusThreadManager::Get()->GetSystemBus(), | 291 chromeos::DBusThreadManager::Get()->GetSystemBus(), |
| 293 chromeos::DBusThreadManager::Get()->IsUsingStub( | 292 chromeos::DBusThreadManager::Get()->IsUsingStub( |
| 294 chromeos::DBusClientBundle::BLUETOOTH)); | 293 chromeos::DBusClientBundle::BLUETOOTH)); |
| 295 chromeos::CrasAudioHandler::InitializeForTesting(); | 294 chromeos::CrasAudioHandler::InitializeForTesting(); |
| 296 #endif | 295 #endif |
| 297 } | 296 } |
| 298 | 297 |
| 299 private: | 298 private: |
| 300 scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 299 scoped_refptr<base::SequencedWorkerPool> worker_pool_; |
| 301 std::unique_ptr<views::AuraInit> aura_init_; | 300 std::unique_ptr<views::AuraInit> aura_init_; |
| 302 ShellDelegateMus* ash_delegate_ = nullptr; | 301 ShellDelegateMus* ash_delegate_ = nullptr; |
| 303 std::unique_ptr<NativeWidgetFactory> native_widget_factory_; | 302 std::unique_ptr<NativeWidgetFactory> native_widget_factory_; |
| 304 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; | 303 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; |
| 305 | 304 |
| 306 DISALLOW_COPY_AND_ASSIGN(AshInit); | 305 DISALLOW_COPY_AND_ASSIGN(AshInit); |
| 307 }; | 306 }; |
| 308 | 307 |
| 309 SysUIApplication::SysUIApplication() {} | 308 SysUIApplication::SysUIApplication() {} |
| 310 | 309 |
| 311 SysUIApplication::~SysUIApplication() {} | 310 SysUIApplication::~SysUIApplication() {} |
| 312 | 311 |
| 313 void SysUIApplication::Initialize(::shell::Connector* connector, | 312 void SysUIApplication::Initialize(::shell::Connector* connector, |
| 314 const ::shell::Identity& identity, | 313 const ::shell::Identity& identity, |
| 315 uint32_t id) { | 314 uint32_t id) { |
| 316 ash_init_.reset(new AshInit()); | 315 ash_init_.reset(new AshInit()); |
| 317 ash_init_->Initialize(connector, identity); | 316 ash_init_->Initialize(connector, identity); |
| 317 |
| 318 input_device::mojom::InputDeviceServerPtr server; |
| 319 connector->ConnectToInterface("mojo:mus", &server); |
| 320 input_device_client_.Connect(std::move(server)); |
| 318 } | 321 } |
| 319 | 322 |
| 320 bool SysUIApplication::AcceptConnection(::shell::Connection* connection) { | 323 bool SysUIApplication::AcceptConnection(::shell::Connection* connection) { |
| 321 connection->AddInterface<mash::shelf::mojom::ShelfController>(this); | 324 connection->AddInterface<mash::shelf::mojom::ShelfController>(this); |
| 322 connection->AddInterface<mojom::WallpaperController>(this); | 325 connection->AddInterface<mojom::WallpaperController>(this); |
| 323 return true; | 326 return true; |
| 324 } | 327 } |
| 325 | 328 |
| 326 void SysUIApplication::Create( | 329 void SysUIApplication::Create( |
| 327 ::shell::Connection* connection, | 330 ::shell::Connection* connection, |
| 328 mash::shelf::mojom::ShelfControllerRequest request) { | 331 mash::shelf::mojom::ShelfControllerRequest request) { |
| 329 mash::shelf::mojom::ShelfController* shelf_controller = | 332 mash::shelf::mojom::ShelfController* shelf_controller = |
| 330 static_cast<ShelfDelegateMus*>(Shell::GetInstance()->GetShelfDelegate()); | 333 static_cast<ShelfDelegateMus*>(Shell::GetInstance()->GetShelfDelegate()); |
| 331 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); | 334 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); |
| 332 } | 335 } |
| 333 | 336 |
| 334 void SysUIApplication::Create(::shell::Connection* connection, | 337 void SysUIApplication::Create(::shell::Connection* connection, |
| 335 mojom::WallpaperControllerRequest request) { | 338 mojom::WallpaperControllerRequest request) { |
| 336 mojom::WallpaperController* wallpaper_controller = | 339 mojom::WallpaperController* wallpaper_controller = |
| 337 static_cast<UserWallpaperDelegateMus*>( | 340 static_cast<UserWallpaperDelegateMus*>( |
| 338 Shell::GetInstance()->user_wallpaper_delegate()); | 341 Shell::GetInstance()->user_wallpaper_delegate()); |
| 339 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, | 342 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, |
| 340 std::move(request)); | 343 std::move(request)); |
| 341 } | 344 } |
| 342 | 345 |
| 343 } // namespace sysui | 346 } // namespace sysui |
| 344 } // namespace ash | 347 } // namespace ash |
| OLD | NEW |