| 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 #if defined(USE_X11) | 7 #if defined(USE_X11) |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
| 10 | 10 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 aura::client::SetCaptureClient(host->window(), new NoneCaptureClient()); | 138 aura::client::SetCaptureClient(host->window(), new NoneCaptureClient()); |
| 139 host->Show(); | 139 host->Show(); |
| 140 | 140 |
| 141 aura::Window* mirror_window = host_info->mirror_window = | 141 aura::Window* mirror_window = host_info->mirror_window = |
| 142 new aura::Window(nullptr); | 142 new aura::Window(nullptr); |
| 143 mirror_window->Init(ui::LAYER_SOLID_COLOR); | 143 mirror_window->Init(ui::LAYER_SOLID_COLOR); |
| 144 host->window()->AddChild(mirror_window); | 144 host->window()->AddChild(mirror_window); |
| 145 mirror_window->SetBounds(host->window()->bounds()); | 145 mirror_window->SetBounds(host->window()->bounds()); |
| 146 mirror_window->Show(); | 146 mirror_window->Show(); |
| 147 if (reflector_) { | 147 if (reflector_) { |
| 148 // TODO(oshima): Enable this once reflector change is landed. | 148 reflector_->AddMirroringLayer(mirror_window->layer()); |
| 149 // reflector_->AddMirroringLayer(mirror_window->layer()); | |
| 150 } else { | 149 } else { |
| 151 reflector_ = | 150 reflector_ = |
| 152 aura::Env::GetInstance()->context_factory()->CreateReflector( | 151 aura::Env::GetInstance()->context_factory()->CreateReflector( |
| 153 Shell::GetPrimaryRootWindow()->GetHost()->compositor(), | 152 Shell::GetPrimaryRootWindow()->GetHost()->compositor(), |
| 154 mirror_window->layer()); | 153 mirror_window->layer()); |
| 155 } | 154 } |
| 156 } else { | 155 } else { |
| 157 aura::WindowTreeHost* host = mirroring_host_info_map_[display_info.id()] | 156 aura::WindowTreeHost* host = mirroring_host_info_map_[display_info.id()] |
| 158 ->ash_host->AsWindowTreeHost(); | 157 ->ash_host->AsWindowTreeHost(); |
| 159 GetRootWindowSettings(host->window())->display_id = display_info.id(); | 158 GetRootWindowSettings(host->window())->display_id = display_info.id(); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 void MirrorWindowController::CloseAndDeleteHost(MirroringHostInfo* host_info) { | 260 void MirrorWindowController::CloseAndDeleteHost(MirroringHostInfo* host_info) { |
| 262 aura::WindowTreeHost* host = host_info->ash_host->AsWindowTreeHost(); | 261 aura::WindowTreeHost* host = host_info->ash_host->AsWindowTreeHost(); |
| 263 NoneCaptureClient* capture_client = static_cast<NoneCaptureClient*>( | 262 NoneCaptureClient* capture_client = static_cast<NoneCaptureClient*>( |
| 264 aura::client::GetCaptureClient(host->window())); | 263 aura::client::GetCaptureClient(host->window())); |
| 265 aura::client::SetCaptureClient(host->window(), NULL); | 264 aura::client::SetCaptureClient(host->window(), NULL); |
| 266 delete capture_client; | 265 delete capture_client; |
| 267 | 266 |
| 268 host->RemoveObserver(Shell::GetInstance()->display_controller()); | 267 host->RemoveObserver(Shell::GetInstance()->display_controller()); |
| 269 host->RemoveObserver(this); | 268 host->RemoveObserver(this); |
| 270 host_info->ash_host->PrepareForShutdown(); | 269 host_info->ash_host->PrepareForShutdown(); |
| 271 // TODO(oshima): Enable this once reflector change is landed. | 270 reflector_->RemoveMirroringLayer(host_info->mirror_window->layer()); |
| 272 // reflector_->RemovedMirroringLayer(mirror_window->layer()); | |
| 273 delete host_info; | 271 delete host_info; |
| 274 } | 272 } |
| 275 | 273 |
| 276 scoped_ptr<RootWindowTransformer> | 274 scoped_ptr<RootWindowTransformer> |
| 277 MirrorWindowController::CreateRootWindowTransformer() const { | 275 MirrorWindowController::CreateRootWindowTransformer() const { |
| 278 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 276 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 279 const DisplayInfo& mirror_display_info = | 277 const DisplayInfo& mirror_display_info = |
| 280 display_manager->GetDisplayInfo(display_manager->mirroring_display_id()); | 278 display_manager->GetDisplayInfo(display_manager->mirroring_display_id()); |
| 281 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( | 279 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( |
| 282 Shell::GetScreen()->GetPrimaryDisplay().id()); | 280 Shell::GetScreen()->GetPrimaryDisplay().id()); |
| 283 DCHECK(display_manager->IsInMirrorMode()); | 281 DCHECK(display_manager->IsInMirrorMode()); |
| 284 return scoped_ptr<RootWindowTransformer>( | 282 return scoped_ptr<RootWindowTransformer>( |
| 285 CreateRootWindowTransformerForMirroredDisplay(source_display_info, | 283 CreateRootWindowTransformerForMirroredDisplay(source_display_info, |
| 286 mirror_display_info)); | 284 mirror_display_info)); |
| 287 } | 285 } |
| 288 | 286 |
| 289 } // namespace ash | 287 } // namespace ash |
| OLD | NEW |