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/mojo_interface_factory.h" | 10 #include "ash/common/mojo_interface_factory.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "ui/views/mus/aura_init.h" | 29 #include "ui/views/mus/aura_init.h" |
30 #include "ui/views/mus/surface_context_factory.h" | 30 #include "ui/views/mus/surface_context_factory.h" |
31 | 31 |
32 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
33 #include "ash/common/system/chromeos/power/power_status.h" | 33 #include "ash/common/system/chromeos/power/power_status.h" |
34 #include "chromeos/audio/cras_audio_handler.h" | 34 #include "chromeos/audio/cras_audio_handler.h" |
35 #include "chromeos/dbus/dbus_thread_manager.h" | 35 #include "chromeos/dbus/dbus_thread_manager.h" |
36 #include "chromeos/network/network_handler.h" | 36 #include "chromeos/network/network_handler.h" |
37 #include "chromeos/system/fake_statistics_provider.h" | 37 #include "chromeos/system/fake_statistics_provider.h" |
38 #include "device/bluetooth/dbus/bluez_dbus_manager.h" // nogncheck | 38 #include "device/bluetooth/dbus/bluez_dbus_manager.h" // nogncheck |
| 39 #include "ui/chromeos/network/network_connect.h" |
39 #endif | 40 #endif |
40 | 41 |
41 namespace ash { | 42 namespace ash { |
42 namespace mus { | 43 namespace mus { |
43 namespace { | |
44 | 44 |
45 void InitializeComponents() { | |
46 message_center::MessageCenter::Initialize(); | |
47 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
48 // Must occur after mojo::ApplicationRunner has initialized AtExitManager, but | 46 // TODO(mash): Replace ui::NetworkConnect::Delegate with a mojo interface on a |
49 // before WindowManager::Init(). | 47 // NetworkConfig service. http://crbug.com/644355 |
50 chromeos::DBusThreadManager::Initialize( | 48 class WindowManagerApplication::StubNetworkConnectDelegate |
51 chromeos::DBusThreadManager::PROCESS_ASH); | 49 : public ui::NetworkConnect::Delegate { |
| 50 public: |
| 51 StubNetworkConnectDelegate() {} |
| 52 ~StubNetworkConnectDelegate() override {} |
52 | 53 |
53 // See ChromeBrowserMainPartsChromeos for ordering details. | 54 void ShowNetworkConfigure(const std::string& network_id) override {} |
54 bluez::BluezDBusManager::Initialize( | 55 void ShowNetworkSettingsForGuid(const std::string& network_id) override {} |
55 chromeos::DBusThreadManager::Get()->GetSystemBus(), | 56 bool ShowEnrollNetwork(const std::string& network_id) override { |
56 chromeos::DBusThreadManager::Get()->IsUsingFakes()); | 57 return false; |
57 chromeos::NetworkHandler::Initialize(); | 58 } |
58 // TODO(jamescook): Initialize real audio handler. | 59 void ShowMobileSimDialog() override {} |
59 chromeos::CrasAudioHandler::InitializeForTesting(); | 60 void ShowMobileSetupDialog(const std::string& service_path) override {} |
60 PowerStatus::Initialize(); | |
61 #endif | |
62 } | |
63 | 61 |
64 void ShutdownComponents() { | 62 private: |
65 #if defined(OS_CHROMEOS) | 63 DISALLOW_COPY_AND_ASSIGN(StubNetworkConnectDelegate); |
66 PowerStatus::Shutdown(); | 64 }; |
67 chromeos::CrasAudioHandler::Shutdown(); | 65 #endif // OS_CHROMEOS |
68 chromeos::NetworkHandler::Shutdown(); | |
69 bluez::BluezDBusManager::Shutdown(); | |
70 chromeos::DBusThreadManager::Shutdown(); | |
71 #endif | |
72 message_center::MessageCenter::Shutdown(); | |
73 } | |
74 | |
75 } // namespace | |
76 | 66 |
77 WindowManagerApplication::WindowManagerApplication() | 67 WindowManagerApplication::WindowManagerApplication() |
78 : screenlock_state_listener_binding_(this) {} | 68 : screenlock_state_listener_binding_(this) {} |
79 | 69 |
80 WindowManagerApplication::~WindowManagerApplication() { | 70 WindowManagerApplication::~WindowManagerApplication() { |
81 // AcceleratorRegistrarImpl removes an observer in its destructor. Destroy | 71 // AcceleratorRegistrarImpl removes an observer in its destructor. Destroy |
82 // it early on. | 72 // it early on. |
83 std::set<AcceleratorRegistrarImpl*> accelerator_registrars( | 73 std::set<AcceleratorRegistrarImpl*> accelerator_registrars( |
84 accelerator_registrars_); | 74 accelerator_registrars_); |
85 for (AcceleratorRegistrarImpl* registrar : accelerator_registrars) | 75 for (AcceleratorRegistrarImpl* registrar : accelerator_registrars) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 statistics_provider_.reset( | 111 statistics_provider_.reset( |
122 new chromeos::system::ScopedFakeStatisticsProvider()); | 112 new chromeos::system::ScopedFakeStatisticsProvider()); |
123 statistics_provider_->SetMachineStatistic("initial_locale", "en-US"); | 113 statistics_provider_->SetMachineStatistic("initial_locale", "en-US"); |
124 statistics_provider_->SetMachineStatistic("keyboard_layout", ""); | 114 statistics_provider_->SetMachineStatistic("keyboard_layout", ""); |
125 #endif | 115 #endif |
126 window_manager_->Init(std::move(window_tree_client), blocking_pool); | 116 window_manager_->Init(std::move(window_tree_client), blocking_pool); |
127 native_widget_factory_mus_ = | 117 native_widget_factory_mus_ = |
128 base::MakeUnique<NativeWidgetFactoryMus>(window_manager_.get()); | 118 base::MakeUnique<NativeWidgetFactoryMus>(window_manager_.get()); |
129 } | 119 } |
130 | 120 |
| 121 void WindowManagerApplication::InitializeComponents() { |
| 122 message_center::MessageCenter::Initialize(); |
| 123 #if defined(OS_CHROMEOS) |
| 124 // Must occur after mojo::ApplicationRunner has initialized AtExitManager, but |
| 125 // before WindowManager::Init(). |
| 126 chromeos::DBusThreadManager::Initialize( |
| 127 chromeos::DBusThreadManager::PROCESS_ASH); |
| 128 |
| 129 // See ChromeBrowserMainPartsChromeos for ordering details. |
| 130 bluez::BluezDBusManager::Initialize( |
| 131 chromeos::DBusThreadManager::Get()->GetSystemBus(), |
| 132 chromeos::DBusThreadManager::Get()->IsUsingFakes()); |
| 133 chromeos::NetworkHandler::Initialize(); |
| 134 network_connect_delegate_.reset(new StubNetworkConnectDelegate()); |
| 135 ui::NetworkConnect::Initialize(network_connect_delegate_.get()); |
| 136 // TODO(jamescook): Initialize real audio handler. |
| 137 chromeos::CrasAudioHandler::InitializeForTesting(); |
| 138 PowerStatus::Initialize(); |
| 139 #endif |
| 140 } |
| 141 |
| 142 void WindowManagerApplication::ShutdownComponents() { |
| 143 #if defined(OS_CHROMEOS) |
| 144 PowerStatus::Shutdown(); |
| 145 chromeos::CrasAudioHandler::Shutdown(); |
| 146 ui::NetworkConnect::Shutdown(); |
| 147 network_connect_delegate_.reset(); |
| 148 chromeos::NetworkHandler::Shutdown(); |
| 149 bluez::BluezDBusManager::Shutdown(); |
| 150 chromeos::DBusThreadManager::Shutdown(); |
| 151 #endif |
| 152 message_center::MessageCenter::Shutdown(); |
| 153 } |
| 154 |
131 void WindowManagerApplication::OnStart(const shell::Identity& identity) { | 155 void WindowManagerApplication::OnStart(const shell::Identity& identity) { |
132 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak", | 156 aura_init_.reset(new views::AuraInit(connector(), "ash_mus_resources.pak", |
133 "ash_mus_resources_200.pak")); | 157 "ash_mus_resources_200.pak")); |
134 gpu_service_ = ui::GpuService::Create(connector()); | 158 gpu_service_ = ui::GpuService::Create(connector()); |
135 compositor_context_factory_.reset( | 159 compositor_context_factory_.reset( |
136 new views::SurfaceContextFactory(gpu_service_.get())); | 160 new views::SurfaceContextFactory(gpu_service_.get())); |
137 aura::Env::GetInstance()->set_context_factory( | 161 aura::Env::GetInstance()->set_context_factory( |
138 compositor_context_factory_.get()); | 162 compositor_context_factory_.get()); |
139 window_manager_.reset(new WindowManager(connector())); | 163 window_manager_.reset(new WindowManager(connector())); |
140 | 164 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, | 231 base::Bind(&WindowManagerApplication::OnAcceleratorRegistrarDestroyed, |
208 base::Unretained(this)))); | 232 base::Unretained(this)))); |
209 } | 233 } |
210 | 234 |
211 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { | 235 void WindowManagerApplication::ScreenlockStateChanged(bool locked) { |
212 window_manager_->SetScreenLocked(locked); | 236 window_manager_->SetScreenLocked(locked); |
213 } | 237 } |
214 | 238 |
215 } // namespace mus | 239 } // namespace mus |
216 } // namespace ash | 240 } // namespace ash |
OLD | NEW |