| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 scoped_ptr<RootWindowTransformer> transformer( | 129 scoped_ptr<RootWindowTransformer> transformer( |
| 130 CreateRootWindowTransformerForMirroredDisplay(source_display_info, | 130 CreateRootWindowTransformerForMirroredDisplay(source_display_info, |
| 131 display_info)); | 131 display_info)); |
| 132 ash_host_->SetRootWindowTransformer(transformer.Pass()); | 132 ash_host_->SetRootWindowTransformer(transformer.Pass()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void MirrorWindowController::UpdateWindow() { | 135 void MirrorWindowController::UpdateWindow() { |
| 136 if (ash_host_.get()) { | 136 if (ash_host_.get()) { |
| 137 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 137 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 138 const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo( | 138 const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo( |
| 139 display_manager->mirrored_display_id()); | 139 display_manager->mirroring_display_id()); |
| 140 UpdateWindow(mirror_display_info); | 140 UpdateWindow(mirror_display_info); |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 | 143 |
| 144 void MirrorWindowController::Close() { | 144 void MirrorWindowController::Close() { |
| 145 if (ash_host_.get()) { | 145 if (ash_host_.get()) { |
| 146 aura::WindowTreeHost* host = ash_host_->AsWindowTreeHost(); | 146 aura::WindowTreeHost* host = ash_host_->AsWindowTreeHost(); |
| 147 aura::Env::GetInstance()->context_factory()->RemoveReflector( | 147 aura::Env::GetInstance()->context_factory()->RemoveReflector( |
| 148 reflector_.get()); | 148 reflector_.get()); |
| 149 reflector_ = nullptr; | 149 reflector_ = nullptr; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 169 } | 169 } |
| 170 | 170 |
| 171 aura::Window* MirrorWindowController::GetWindow() { | 171 aura::Window* MirrorWindowController::GetWindow() { |
| 172 return ash_host_.get() ? ash_host_->AsWindowTreeHost()->window() : NULL; | 172 return ash_host_.get() ? ash_host_->AsWindowTreeHost()->window() : NULL; |
| 173 } | 173 } |
| 174 | 174 |
| 175 scoped_ptr<RootWindowTransformer> | 175 scoped_ptr<RootWindowTransformer> |
| 176 MirrorWindowController::CreateRootWindowTransformer() const { | 176 MirrorWindowController::CreateRootWindowTransformer() const { |
| 177 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 177 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 178 const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo( | 178 const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo( |
| 179 display_manager->mirrored_display_id()); | 179 display_manager->mirroring_display_id()); |
| 180 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( | 180 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( |
| 181 Shell::GetScreen()->GetPrimaryDisplay().id()); | 181 Shell::GetScreen()->GetPrimaryDisplay().id()); |
| 182 DCHECK(display_manager->IsMirrored()); | 182 DCHECK(display_manager->IsMirrored()); |
| 183 return scoped_ptr<RootWindowTransformer>( | 183 return scoped_ptr<RootWindowTransformer>( |
| 184 CreateRootWindowTransformerForMirroredDisplay(source_display_info, | 184 CreateRootWindowTransformerForMirroredDisplay(source_display_info, |
| 185 mirror_display_info)); | 185 mirror_display_info)); |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace ash | 188 } // namespace ash |
| OLD | NEW |