Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: services/ui/service.cc

Issue 2487573002: Service Manager: Remove ServiceContext* arg from Service::OnStart() (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/ui/service.h ('k') | services/ui/test_wm/test_wm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "services/ui/service.h" 5 #include "services/ui/service.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 return it->second.get(); 130 return it->second.get();
131 user_id_to_user_state_[user_id] = base::WrapUnique(new UserState); 131 user_id_to_user_state_[user_id] = base::WrapUnique(new UserState);
132 return user_id_to_user_state_[user_id].get(); 132 return user_id_to_user_state_[user_id].get();
133 } 133 }
134 134
135 void Service::AddUserIfNecessary( 135 void Service::AddUserIfNecessary(
136 const service_manager::Identity& remote_identity) { 136 const service_manager::Identity& remote_identity) {
137 window_server_->user_id_tracker()->AddUserId(remote_identity.user_id()); 137 window_server_->user_id_tracker()->AddUserId(remote_identity.user_id());
138 } 138 }
139 139
140 void Service::OnStart(service_manager::ServiceContext* context) { 140 void Service::OnStart() {
141 base::PlatformThread::SetName("mus"); 141 base::PlatformThread::SetName("mus");
142 tracing_.Initialize(context->connector(), context->identity().name()); 142 tracing_.Initialize(context()->connector(), context()->identity().name());
143 TRACE_EVENT0("mus", "Service::Initialize started"); 143 TRACE_EVENT0("mus", "Service::Initialize started");
144 144
145 test_config_ = base::CommandLine::ForCurrentProcess()->HasSwitch( 145 test_config_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
146 switches::kUseTestConfig); 146 switches::kUseTestConfig);
147 #if defined(USE_X11) 147 #if defined(USE_X11)
148 XInitThreads(); 148 XInitThreads();
149 if (test_config_) 149 if (test_config_)
150 ui::test::SetUseOverrideRedirectWindowByDefault(true); 150 ui::test::SetUseOverrideRedirectWindowByDefault(true);
151 #endif 151 #endif
152 152
153 InitializeResources(context->connector()); 153 InitializeResources(context()->connector());
154 154
155 #if defined(USE_OZONE) 155 #if defined(USE_OZONE)
156 // The ozone platform can provide its own event source. So initialize the 156 // The ozone platform can provide its own event source. So initialize the
157 // platform before creating the default event source. 157 // platform before creating the default event source.
158 // Because GL libraries need to be initialized before entering the sandbox, 158 // Because GL libraries need to be initialized before entering the sandbox,
159 // in MUS, |InitializeForUI| will load the GL libraries. 159 // in MUS, |InitializeForUI| will load the GL libraries.
160 ui::OzonePlatform::InitParams params; 160 ui::OzonePlatform::InitParams params;
161 params.connector = context->connector(); 161 params.connector = context()->connector();
162 params.single_process = false; 162 params.single_process = false;
163 ui::OzonePlatform::InitializeForUI(params); 163 ui::OzonePlatform::InitializeForUI(params);
164 164
165 // TODO(kylechar): We might not always want a US keyboard layout. 165 // TODO(kylechar): We might not always want a US keyboard layout.
166 ui::KeyboardLayoutEngineManager::GetKeyboardLayoutEngine() 166 ui::KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()
167 ->SetCurrentLayoutByName("us"); 167 ->SetCurrentLayoutByName("us");
168 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); 168 client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create();
169 ui::ClientNativePixmapFactory::SetInstance( 169 ui::ClientNativePixmapFactory::SetInstance(
170 client_native_pixmap_factory_.get()); 170 client_native_pixmap_factory_.get());
171 171
(...skipping 16 matching lines...) Expand all
188 window_server_.reset(new ws::WindowServer(this)); 188 window_server_.reset(new ws::WindowServer(this));
189 189
190 // DeviceDataManager must be initialized before TouchController. On non-Linux 190 // DeviceDataManager must be initialized before TouchController. On non-Linux
191 // platforms there is no DeviceDataManager so don't create touch controller. 191 // platforms there is no DeviceDataManager so don't create touch controller.
192 if (ui::DeviceDataManager::HasInstance()) 192 if (ui::DeviceDataManager::HasInstance())
193 touch_controller_.reset( 193 touch_controller_.reset(
194 new ws::TouchController(window_server_->display_manager())); 194 new ws::TouchController(window_server_->display_manager()));
195 195
196 platform_screen_->Init(window_server_->display_manager()); 196 platform_screen_->Init(window_server_->display_manager());
197 197
198 ime_server_.Init(context->connector()); 198 ime_server_.Init(context()->connector());
199 } 199 }
200 200
201 bool Service::OnConnect(const service_manager::ServiceInfo& remote_info, 201 bool Service::OnConnect(const service_manager::ServiceInfo& remote_info,
202 service_manager::InterfaceRegistry* registry) { 202 service_manager::InterfaceRegistry* registry) {
203 registry->AddInterface<mojom::AccessibilityManager>(this); 203 registry->AddInterface<mojom::AccessibilityManager>(this);
204 registry->AddInterface<mojom::Clipboard>(this); 204 registry->AddInterface<mojom::Clipboard>(this);
205 registry->AddInterface<mojom::DisplayManager>(this); 205 registry->AddInterface<mojom::DisplayManager>(this);
206 registry->AddInterface<mojom::GpuService>(this); 206 registry->AddInterface<mojom::GpuService>(this);
207 registry->AddInterface<mojom::IMERegistrar>(this); 207 registry->AddInterface<mojom::IMERegistrar>(this);
208 registry->AddInterface<mojom::IMEServer>(this); 208 registry->AddInterface<mojom::IMEServer>(this);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 mojom::WindowServerTestRequest request) { 358 mojom::WindowServerTestRequest request) {
359 if (!test_config_) 359 if (!test_config_)
360 return; 360 return;
361 mojo::MakeStrongBinding( 361 mojo::MakeStrongBinding(
362 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()), 362 base::MakeUnique<ws::WindowServerTestImpl>(window_server_.get()),
363 std::move(request)); 363 std::move(request));
364 } 364 }
365 365
366 366
367 } // namespace ui 367 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/service.h ('k') | services/ui/test_wm/test_wm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698