| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile100), | 275 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile100), |
| 276 ui::SCALE_FACTOR_100P); | 276 ui::SCALE_FACTOR_100P); |
| 277 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile200), | 277 rb.AddDataPackFromFile(loader.TakeFile(kResourceFile200), |
| 278 ui::SCALE_FACTOR_200P); | 278 ui::SCALE_FACTOR_200P); |
| 279 } | 279 } |
| 280 | 280 |
| 281 void InitializeComponents() { | 281 void InitializeComponents() { |
| 282 message_center::MessageCenter::Initialize(); | 282 message_center::MessageCenter::Initialize(); |
| 283 | 283 |
| 284 #if defined(OS_CHROMEOS) | 284 #if defined(OS_CHROMEOS) |
| 285 ui::DeviceDataManager::CreateInstance(); | |
| 286 chromeos::DBusThreadManager::Initialize(); | 285 chromeos::DBusThreadManager::Initialize(); |
| 287 bluez::BluezDBusManager::Initialize( | 286 bluez::BluezDBusManager::Initialize( |
| 288 chromeos::DBusThreadManager::Get()->GetSystemBus(), | 287 chromeos::DBusThreadManager::Get()->GetSystemBus(), |
| 289 chromeos::DBusThreadManager::Get()->IsUsingStub( | 288 chromeos::DBusThreadManager::Get()->IsUsingStub( |
| 290 chromeos::DBusClientBundle::BLUETOOTH)); | 289 chromeos::DBusClientBundle::BLUETOOTH)); |
| 291 chromeos::CrasAudioHandler::InitializeForTesting(); | 290 chromeos::CrasAudioHandler::InitializeForTesting(); |
| 292 #endif | 291 #endif |
| 293 } | 292 } |
| 294 | 293 |
| 295 private: | 294 private: |
| 296 scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 295 scoped_refptr<base::SequencedWorkerPool> worker_pool_; |
| 297 std::unique_ptr<views::AuraInit> aura_init_; | 296 std::unique_ptr<views::AuraInit> aura_init_; |
| 298 ShellDelegateMus* ash_delegate_ = nullptr; | 297 ShellDelegateMus* ash_delegate_ = nullptr; |
| 299 std::unique_ptr<NativeWidgetFactory> native_widget_factory_; | 298 std::unique_ptr<NativeWidgetFactory> native_widget_factory_; |
| 300 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; | 299 std::unique_ptr<views::WindowManagerConnection> window_manager_connection_; |
| 301 | 300 |
| 302 DISALLOW_COPY_AND_ASSIGN(AshInit); | 301 DISALLOW_COPY_AND_ASSIGN(AshInit); |
| 303 }; | 302 }; |
| 304 | 303 |
| 305 SysUIApplication::SysUIApplication() {} | 304 SysUIApplication::SysUIApplication() {} |
| 306 | 305 |
| 307 SysUIApplication::~SysUIApplication() {} | 306 SysUIApplication::~SysUIApplication() {} |
| 308 | 307 |
| 309 void SysUIApplication::Initialize(::shell::Connector* connector, | 308 void SysUIApplication::Initialize(::shell::Connector* connector, |
| 310 const ::shell::Identity& identity, | 309 const ::shell::Identity& identity, |
| 311 uint32_t id) { | 310 uint32_t id) { |
| 312 ash_init_.reset(new AshInit()); | 311 ash_init_.reset(new AshInit()); |
| 313 ash_init_->Initialize(connector, identity); | 312 ash_init_->Initialize(connector, identity); |
| 313 |
| 314 mus::mojom::InputDeviceServerPtr server; |
| 315 connector->ConnectToInterface("mojo:mus", &server); |
| 316 input_device_client_.Connect(std::move(server)); |
| 314 } | 317 } |
| 315 | 318 |
| 316 bool SysUIApplication::AcceptConnection(::shell::Connection* connection) { | 319 bool SysUIApplication::AcceptConnection(::shell::Connection* connection) { |
| 317 connection->AddInterface<mash::shelf::mojom::ShelfController>(this); | 320 connection->AddInterface<mash::shelf::mojom::ShelfController>(this); |
| 318 connection->AddInterface<mojom::WallpaperController>(this); | 321 connection->AddInterface<mojom::WallpaperController>(this); |
| 319 return true; | 322 return true; |
| 320 } | 323 } |
| 321 | 324 |
| 322 void SysUIApplication::Create( | 325 void SysUIApplication::Create( |
| 323 ::shell::Connection* connection, | 326 ::shell::Connection* connection, |
| 324 mash::shelf::mojom::ShelfControllerRequest request) { | 327 mash::shelf::mojom::ShelfControllerRequest request) { |
| 325 mash::shelf::mojom::ShelfController* shelf_controller = | 328 mash::shelf::mojom::ShelfController* shelf_controller = |
| 326 static_cast<ShelfDelegateMus*>(Shell::GetInstance()->GetShelfDelegate()); | 329 static_cast<ShelfDelegateMus*>(Shell::GetInstance()->GetShelfDelegate()); |
| 327 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); | 330 shelf_controller_bindings_.AddBinding(shelf_controller, std::move(request)); |
| 328 } | 331 } |
| 329 | 332 |
| 330 void SysUIApplication::Create(::shell::Connection* connection, | 333 void SysUIApplication::Create(::shell::Connection* connection, |
| 331 mojom::WallpaperControllerRequest request) { | 334 mojom::WallpaperControllerRequest request) { |
| 332 mojom::WallpaperController* wallpaper_controller = | 335 mojom::WallpaperController* wallpaper_controller = |
| 333 static_cast<UserWallpaperDelegateMus*>( | 336 static_cast<UserWallpaperDelegateMus*>( |
| 334 Shell::GetInstance()->user_wallpaper_delegate()); | 337 Shell::GetInstance()->user_wallpaper_delegate()); |
| 335 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, | 338 wallpaper_controller_bindings_.AddBinding(wallpaper_controller, |
| 336 std::move(request)); | 339 std::move(request)); |
| 337 } | 340 } |
| 338 | 341 |
| 339 } // namespace sysui | 342 } // namespace sysui |
| 340 } // namespace ash | 343 } // namespace ash |
| OLD | NEW |