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/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "ui/aura/env.h" | 24 #include "ui/aura/env.h" |
25 #include "ui/events/event.h" | 25 #include "ui/events/event.h" |
26 #include "ui/message_center/message_center.h" | 26 #include "ui/message_center/message_center.h" |
27 #include "ui/views/mus/aura_init.h" | 27 #include "ui/views/mus/aura_init.h" |
28 #include "ui/views/mus/surface_context_factory.h" | 28 #include "ui/views/mus/surface_context_factory.h" |
29 | 29 |
30 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
31 #include "ash/common/system/chromeos/power/power_status.h" | 31 #include "ash/common/system/chromeos/power/power_status.h" |
32 #include "chromeos/audio/cras_audio_handler.h" | 32 #include "chromeos/audio/cras_audio_handler.h" |
33 #include "chromeos/dbus/dbus_thread_manager.h" | 33 #include "chromeos/dbus/dbus_thread_manager.h" |
| 34 #include "chromeos/system/fake_statistics_provider.h" |
34 #include "device/bluetooth/dbus/bluez_dbus_manager.h" // nogncheck | 35 #include "device/bluetooth/dbus/bluez_dbus_manager.h" // nogncheck |
35 #endif | 36 #endif |
36 | 37 |
37 namespace ash { | 38 namespace ash { |
38 namespace mus { | 39 namespace mus { |
39 namespace { | 40 namespace { |
40 | 41 |
41 void InitializeComponents() { | 42 void InitializeComponents() { |
42 message_center::MessageCenter::Initialize(); | 43 message_center::MessageCenter::Initialize(); |
43 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
44 // Must occur after mojo::ApplicationRunner has initialized AtExitManager, but | 45 // Must occur after mojo::ApplicationRunner has initialized AtExitManager, but |
45 // before WindowManager::Init(). | 46 // before WindowManager::Init(). |
46 chromeos::DBusThreadManager::Initialize(); | 47 chromeos::DBusThreadManager::Initialize(); |
| 48 |
| 49 // See ChromeBrowserMainPartsChromeos for ordering details. |
47 bluez::BluezDBusManager::Initialize( | 50 bluez::BluezDBusManager::Initialize( |
48 chromeos::DBusThreadManager::Get()->GetSystemBus(), | 51 chromeos::DBusThreadManager::Get()->GetSystemBus(), |
49 chromeos::DBusThreadManager::Get()->IsUsingStub( | 52 chromeos::DBusThreadManager::Get()->IsUsingStub( |
50 chromeos::DBusClientBundle::BLUETOOTH)); | 53 chromeos::DBusClientBundle::BLUETOOTH)); |
51 // TODO(jamescook): Initialize real audio handler. | 54 // TODO(jamescook): Initialize real audio handler. |
52 chromeos::CrasAudioHandler::InitializeForTesting(); | 55 chromeos::CrasAudioHandler::InitializeForTesting(); |
53 PowerStatus::Initialize(); | 56 PowerStatus::Initialize(); |
54 #endif | 57 #endif |
55 } | 58 } |
56 | 59 |
(...skipping 17 matching lines...) Expand all Loading... |
74 // it early on. | 77 // it early on. |
75 std::set<AcceleratorRegistrarImpl*> accelerator_registrars( | 78 std::set<AcceleratorRegistrarImpl*> accelerator_registrars( |
76 accelerator_registrars_); | 79 accelerator_registrars_); |
77 for (AcceleratorRegistrarImpl* registrar : accelerator_registrars) | 80 for (AcceleratorRegistrarImpl* registrar : accelerator_registrars) |
78 registrar->Destroy(); | 81 registrar->Destroy(); |
79 | 82 |
80 // Destroy the WindowManager while still valid. This way we ensure | 83 // Destroy the WindowManager while still valid. This way we ensure |
81 // OnWillDestroyRootWindowController() is called (if it hasn't been already). | 84 // OnWillDestroyRootWindowController() is called (if it hasn't been already). |
82 window_manager_.reset(); | 85 window_manager_.reset(); |
83 gpu_service_.reset(); | 86 gpu_service_.reset(); |
| 87 #if defined(OS_CHROMEOS) |
| 88 statistics_provider_.reset(); |
| 89 #endif |
84 ShutdownComponents(); | 90 ShutdownComponents(); |
85 } | 91 } |
86 | 92 |
87 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( | 93 void WindowManagerApplication::OnAcceleratorRegistrarDestroyed( |
88 AcceleratorRegistrarImpl* registrar) { | 94 AcceleratorRegistrarImpl* registrar) { |
89 accelerator_registrars_.erase(registrar); | 95 accelerator_registrars_.erase(registrar); |
90 } | 96 } |
91 | 97 |
92 void WindowManagerApplication::InitWindowManager( | 98 void WindowManagerApplication::InitWindowManager( |
93 ui::WindowTreeClient* window_tree_client) { | 99 ui::WindowTreeClient* window_tree_client) { |
94 InitializeComponents(); | 100 InitializeComponents(); |
95 | 101 #if defined(OS_CHROMEOS) |
| 102 // TODO(jamescook): Refactor StatisticsProvider so we can get just the data |
| 103 // we need in ash. Right now StatisticsProviderImpl launches the crossystem |
| 104 // binary to get system data, which we don't want to do twice on startup. |
| 105 statistics_provider_.reset( |
| 106 new chromeos::system::ScopedFakeStatisticsProvider()); |
| 107 statistics_provider_->SetMachineStatistic("initial_locale", "en-US"); |
| 108 statistics_provider_->SetMachineStatistic("keyboard_layout", ""); |
| 109 #endif |
96 window_manager_->Init(window_tree_client); | 110 window_manager_->Init(window_tree_client); |
97 } | 111 } |
98 | 112 |
99 void WindowManagerApplication::OnStart(const shell::Identity& identity) { | 113 void WindowManagerApplication::OnStart(const shell::Identity& identity) { |
100 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak")); | 114 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak")); |
101 gpu_service_ = ui::GpuService::Create(connector()); | 115 gpu_service_ = ui::GpuService::Create(connector()); |
102 compositor_context_factory_.reset( | 116 compositor_context_factory_.reset( |
103 new views::SurfaceContextFactory(gpu_service_.get())); | 117 new views::SurfaceContextFactory(gpu_service_.get())); |
104 aura::Env::GetInstance()->set_context_factory( | 118 aura::Env::GetInstance()->set_context_factory( |
105 compositor_context_factory_.get()); | 119 compositor_context_factory_.get()); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, | 172 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, |
159 base::Unretained(this)))); | 173 base::Unretained(this)))); |
160 } | 174 } |
161 | 175 |
162 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { | 176 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { |
163 window_manager_->SetScreenLocked(locked); | 177 window_manager_->SetScreenLocked(locked); |
164 } | 178 } |
165 | 179 |
166 } // namespace mus | 180 } // namespace mus |
167 } // namespace ash | 181 } // namespace ash |
OLD | NEW |