| OLD | NEW |
| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 aura::Env::GetInstance()->context_factory()->CreateReflector( | 230 aura::Env::GetInstance()->context_factory()->CreateReflector( |
| 231 Shell::GetPrimaryRootWindow()->GetHost()->compositor(), | 231 Shell::GetPrimaryRootWindow()->GetHost()->compositor(), |
| 232 mirror_window->layer()); | 232 mirror_window->layer()); |
| 233 } | 233 } |
| 234 } else { | 234 } else { |
| 235 AshWindowTreeHost* ash_host = | 235 AshWindowTreeHost* ash_host = |
| 236 mirroring_host_info_map_[display_info.id()]->ash_host.get(); | 236 mirroring_host_info_map_[display_info.id()]->ash_host.get(); |
| 237 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); | 237 aura::WindowTreeHost* host = ash_host->AsWindowTreeHost(); |
| 238 GetRootWindowSettings(host->window())->display_id = display_info.id(); | 238 GetRootWindowSettings(host->window())->display_id = display_info.id(); |
| 239 ash_host->SetRootWindowTransformer(std::move(transformer)); | 239 ash_host->SetRootWindowTransformer(std::move(transformer)); |
| 240 host->SetBounds(display_info.bounds_in_native()); | 240 host->SetBoundsInPixels(display_info.bounds_in_native()); |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Deleting WTHs for disconnected displays. | 244 // Deleting WTHs for disconnected displays. |
| 245 if (mirroring_host_info_map_.size() > display_info_list.size()) { | 245 if (mirroring_host_info_map_.size() > display_info_list.size()) { |
| 246 for (MirroringHostInfoMap::iterator iter = mirroring_host_info_map_.begin(); | 246 for (MirroringHostInfoMap::iterator iter = mirroring_host_info_map_.begin(); |
| 247 iter != mirroring_host_info_map_.end();) { | 247 iter != mirroring_host_info_map_.end();) { |
| 248 if (std::find_if(display_info_list.begin(), display_info_list.end(), | 248 if (std::find_if(display_info_list.begin(), display_info_list.end(), |
| 249 [iter](const display::ManagedDisplayInfo& info) { | 249 [iter](const display::ManagedDisplayInfo& info) { |
| 250 return info.id() == iter->first; | 250 return info.id() == iter->first; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 aura::Env::GetInstance()->context_factory()->RemoveReflector( | 286 aura::Env::GetInstance()->context_factory()->RemoveReflector( |
| 287 reflector_.get()); | 287 reflector_.get()); |
| 288 reflector_.reset(); | 288 reflector_.reset(); |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 | 291 |
| 292 void MirrorWindowController::OnHostResized(const aura::WindowTreeHost* host) { | 292 void MirrorWindowController::OnHostResized(const aura::WindowTreeHost* host) { |
| 293 for (auto& pair : mirroring_host_info_map_) { | 293 for (auto& pair : mirroring_host_info_map_) { |
| 294 MirroringHostInfo* info = pair.second; | 294 MirroringHostInfo* info = pair.second; |
| 295 if (info->ash_host->AsWindowTreeHost() == host) { | 295 if (info->ash_host->AsWindowTreeHost() == host) { |
| 296 if (info->mirror_window_host_size == host->GetBounds().size()) | 296 if (info->mirror_window_host_size == host->GetBoundsInPixels().size()) |
| 297 return; | 297 return; |
| 298 info->mirror_window_host_size = host->GetBounds().size(); | 298 info->mirror_window_host_size = host->GetBoundsInPixels().size(); |
| 299 reflector_->OnMirroringCompositorResized(); | 299 reflector_->OnMirroringCompositorResized(); |
| 300 // No need to update the transformer as new transformer is already set | 300 // No need to update the transformer as new transformer is already set |
| 301 // in UpdateWindow. | 301 // in UpdateWindow. |
| 302 Shell::GetInstance() | 302 Shell::GetInstance() |
| 303 ->window_tree_host_manager() | 303 ->window_tree_host_manager() |
| 304 ->cursor_window_controller() | 304 ->cursor_window_controller() |
| 305 ->UpdateLocation(); | 305 ->UpdateLocation(); |
| 306 return; | 306 return; |
| 307 } | 307 } |
| 308 } | 308 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // EventProcessor may be accessed after this call if the mirroring window | 371 // EventProcessor may be accessed after this call if the mirroring window |
| 372 // was deleted as a result of input event (e.g. shortcut), so don't delete | 372 // was deleted as a result of input event (e.g. shortcut), so don't delete |
| 373 // now. | 373 // now. |
| 374 if (delay_host_deletion) | 374 if (delay_host_deletion) |
| 375 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info); | 375 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, host_info); |
| 376 else | 376 else |
| 377 delete host_info; | 377 delete host_info; |
| 378 } | 378 } |
| 379 | 379 |
| 380 } // namespace ash | 380 } // namespace ash |
| OLD | NEW |