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

Side by Side Diff: ash/display/mirror_window_controller.cc

Issue 2858563002: Revert of chromeos: Makes mushrome use simplified display management (Closed)
Patch Set: Created 3 years, 7 months 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 | « ash/aura/shell_port_classic.cc ('k') | ash/display/window_tree_host_manager.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/display/mirror_window_controller.h" 5 #include "ash/display/mirror_window_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #if defined(USE_X11) 9 #if defined(USE_X11)
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 transformer.reset(CreateRootWindowTransformerForUnifiedDesktop( 166 transformer.reset(CreateRootWindowTransformerForUnifiedDesktop(
167 primary.bounds(), display)); 167 primary.bounds(), display));
168 } else { 168 } else {
169 NOTREACHED(); 169 NOTREACHED();
170 } 170 }
171 171
172 if (mirroring_host_info_map_.find(display_info.id()) == 172 if (mirroring_host_info_map_.find(display_info.id()) ==
173 mirroring_host_info_map_.end()) { 173 mirroring_host_info_map_.end()) {
174 AshWindowTreeHostInitParams init_params; 174 AshWindowTreeHostInitParams init_params;
175 init_params.initial_bounds = display_info.bounds_in_native(); 175 init_params.initial_bounds = display_info.bounds_in_native();
176 init_params.display_id = display_info.id();
177 init_params.device_scale_factor = display_info.device_scale_factor();
178 init_params.ui_scale_factor = display_info.configured_ui_scale();
179 MirroringHostInfo* host_info = new MirroringHostInfo; 176 MirroringHostInfo* host_info = new MirroringHostInfo;
180 host_info->ash_host = AshWindowTreeHost::Create(init_params); 177 host_info->ash_host = AshWindowTreeHost::Create(init_params);
181 mirroring_host_info_map_[display_info.id()] = host_info; 178 mirroring_host_info_map_[display_info.id()] = host_info;
182 179
183 aura::WindowTreeHost* host = host_info->ash_host->AsWindowTreeHost(); 180 aura::WindowTreeHost* host = host_info->ash_host->AsWindowTreeHost();
184 // TODO: Config::MUS should not install an InputMethod. 181 host->SetSharedInputMethod(
185 // http://crbug.com/706913 182 Shell::Get()->window_tree_host_manager()->input_method());
186 if (!host->has_input_method()) {
187 host->SetSharedInputMethod(
188 Shell::Get()->window_tree_host_manager()->input_method());
189 }
190 host->window()->SetName( 183 host->window()->SetName(
191 base::StringPrintf("MirrorRootWindow-%d", mirror_host_count++)); 184 base::StringPrintf("MirrorRootWindow-%d", mirror_host_count++));
192 host->compositor()->SetBackgroundColor(SK_ColorBLACK); 185 host->compositor()->SetBackgroundColor(SK_ColorBLACK);
193 // No need to remove the observer because the WindowTreeHostManager 186 // No need to remove the observer because the WindowTreeHostManager
194 // outlives the host. 187 // outlives the host.
195 host->AddObserver(Shell::Get()->window_tree_host_manager()); 188 host->AddObserver(Shell::Get()->window_tree_host_manager());
196 host->AddObserver(this); 189 host->AddObserver(this);
197 // TODO(oshima): TouchHUD is using idkey. 190 // TODO(oshima): TouchHUD is using idkey.
198 InitRootWindowSettings(host->window())->display_id = display_info.id(); 191 InitRootWindowSettings(host->window())->display_id = display_info.id();
199 host->InitHost(); 192 host->InitHost();
(...skipping 22 matching lines...) Expand all
222 215
223 aura::Window* mirror_window = host_info->mirror_window = 216 aura::Window* mirror_window = host_info->mirror_window =
224 new aura::Window(nullptr); 217 new aura::Window(nullptr);
225 mirror_window->Init(ui::LAYER_SOLID_COLOR); 218 mirror_window->Init(ui::LAYER_SOLID_COLOR);
226 host->window()->AddChild(mirror_window); 219 host->window()->AddChild(mirror_window);
227 host_info->ash_host->SetRootWindowTransformer(std::move(transformer)); 220 host_info->ash_host->SetRootWindowTransformer(std::move(transformer));
228 mirror_window->SetBounds(host->window()->bounds()); 221 mirror_window->SetBounds(host->window()->bounds());
229 mirror_window->Show(); 222 mirror_window->Show();
230 if (reflector_) { 223 if (reflector_) {
231 reflector_->AddMirroringLayer(mirror_window->layer()); 224 reflector_->AddMirroringLayer(mirror_window->layer());
232 } else if (aura::Env::GetInstance()->context_factory_private()) { 225 } else {
233 reflector_ = 226 reflector_ =
234 aura::Env::GetInstance() 227 aura::Env::GetInstance()
235 ->context_factory_private() 228 ->context_factory_private()
236 ->CreateReflector( 229 ->CreateReflector(
237 Shell::GetPrimaryRootWindow()->GetHost()->compositor(), 230 Shell::GetPrimaryRootWindow()->GetHost()->compositor(),
238 mirror_window->layer()); 231 mirror_window->layer());
239 } else {
240 // TODO: Config::MUS needs to support reflector.
241 // http://crbug.com/601869.
242 NOTIMPLEMENTED();
243 } 232 }
244 } else { 233 } else {
245 AshWindowTreeHost* ash_host = 234 AshWindowTreeHost* ash_host =
246 mirroring_host_info_map_[display_info.id()]->ash_host.get(); 235 mirroring_host_info_map_[display_info.id()]->ash_host.get();
247 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); 236 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost();
248 GetRootWindowSettings(host->window())->display_id = display_info.id(); 237 GetRootWindowSettings(host->window())->display_id = display_info.id();
249 ash_host->SetRootWindowTransformer(std::move(transformer)); 238 ash_host->SetRootWindowTransformer(std::move(transformer));
250 host->SetBoundsInPixels(display_info.bounds_in_native()); 239 host->SetBoundsInPixels(display_info.bounds_in_native());
251 } 240 }
252 } 241 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 287 }
299 } 288 }
300 289
301 void MirrorWindowController::OnHostResized(const aura::WindowTreeHost* host) { 290 void MirrorWindowController::OnHostResized(const aura::WindowTreeHost* host) {
302 for (auto& pair : mirroring_host_info_map_) { 291 for (auto& pair : mirroring_host_info_map_) {
303 MirroringHostInfo* info = pair.second; 292 MirroringHostInfo* info = pair.second;
304 if (info->ash_host->AsWindowTreeHost() == host) { 293 if (info->ash_host->AsWindowTreeHost() == host) {
305 if (info->mirror_window_host_size == host->GetBoundsInPixels().size()) 294 if (info->mirror_window_host_size == host->GetBoundsInPixels().size())
306 return; 295 return;
307 info->mirror_window_host_size = host->GetBoundsInPixels().size(); 296 info->mirror_window_host_size = host->GetBoundsInPixels().size();
308 // TODO: |reflector_| should always be non-null here, but isn't in MUS 297 reflector_->OnMirroringCompositorResized();
309 // yet because of http://crbug.com/601869.
310 if (reflector_)
311 reflector_->OnMirroringCompositorResized();
312 // No need to update the transformer as new transformer is already set 298 // No need to update the transformer as new transformer is already set
313 // in UpdateWindow. 299 // in UpdateWindow.
314 Shell::Get() 300 Shell::Get()
315 ->window_tree_host_manager() 301 ->window_tree_host_manager()
316 ->cursor_window_controller() 302 ->cursor_window_controller()
317 ->UpdateLocation(); 303 ->UpdateLocation();
318 return; 304 return;
319 } 305 }
320 } 306 }
321 } 307 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 aura::client::SetScreenPositionClient(host->window(), nullptr); 355 aura::client::SetScreenPositionClient(host->window(), nullptr);
370 356
371 NoneCaptureClient* capture_client = static_cast<NoneCaptureClient*>( 357 NoneCaptureClient* capture_client = static_cast<NoneCaptureClient*>(
372 aura::client::GetCaptureClient(host->window())); 358 aura::client::GetCaptureClient(host->window()));
373 aura::client::SetCaptureClient(host->window(), nullptr); 359 aura::client::SetCaptureClient(host->window(), nullptr);
374 delete capture_client; 360 delete capture_client;
375 361
376 host->RemoveObserver(Shell::Get()->window_tree_host_manager()); 362 host->RemoveObserver(Shell::Get()->window_tree_host_manager());
377 host->RemoveObserver(this); 363 host->RemoveObserver(this);
378 host_info->ash_host->PrepareForShutdown(); 364 host_info->ash_host->PrepareForShutdown();
379 // TODO: |reflector_| should always be non-null here, but isn't in MUS yet 365 reflector_->RemoveMirroringLayer(host_info->mirror_window->layer());
380 // because of http://crbug.com/601869.
381 if (reflector_)
382 reflector_->RemoveMirroringLayer(host_info->mirror_window->layer());
383 366
384 // EventProcessor may be accessed after this call if the mirroring window 367 // EventProcessor may be accessed after this call if the mirroring window
385 // was deleted as a result of input event (e.g. shortcut), so don't delete 368 // was deleted as a result of input event (e.g. shortcut), so don't delete
386 // now. 369 // now.
387 if (delay_host_deletion) 370 if (delay_host_deletion)
388 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info); 371 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info);
389 else 372 else
390 delete host_info; 373 delete host_info;
391 } 374 }
392 375
393 } // namespace ash 376 } // namespace ash
OLDNEW
« no previous file with comments | « ash/aura/shell_port_classic.cc ('k') | ash/display/window_tree_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698