| 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/Xlib.h> | 10 #include <X11/Xlib.h> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "base/strings/stringprintf.h" | 28 #include "base/strings/stringprintf.h" |
| 29 #include "ui/aura/client/capture_client.h" | 29 #include "ui/aura/client/capture_client.h" |
| 30 #include "ui/aura/env.h" | 30 #include "ui/aura/env.h" |
| 31 #include "ui/aura/window_delegate.h" | 31 #include "ui/aura/window_delegate.h" |
| 32 #include "ui/aura/window_event_dispatcher.h" | 32 #include "ui/aura/window_event_dispatcher.h" |
| 33 #include "ui/aura/window_tree_host.h" | 33 #include "ui/aura/window_tree_host.h" |
| 34 #include "ui/base/layout.h" | 34 #include "ui/base/layout.h" |
| 35 #include "ui/compositor/reflector.h" | 35 #include "ui/compositor/reflector.h" |
| 36 #include "ui/gfx/canvas.h" | 36 #include "ui/gfx/canvas.h" |
| 37 #include "ui/gfx/native_widget_types.h" | 37 #include "ui/gfx/native_widget_types.h" |
| 38 #include "ui/gfx/screen.h" |
| 38 | 39 |
| 39 #if defined(USE_X11) | 40 #if defined(USE_X11) |
| 40 #include "ui/gfx/x/x11_types.h" | 41 #include "ui/gfx/x/x11_types.h" |
| 41 #endif | 42 #endif |
| 42 | 43 |
| 43 namespace ash { | 44 namespace ash { |
| 44 namespace { | 45 namespace { |
| 45 | 46 |
| 46 #if defined(USE_X11) | 47 #if defined(USE_X11) |
| 47 // Mirror window shouldn't handle input events. | 48 // Mirror window shouldn't handle input events. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 153 |
| 153 MirrorWindowController::~MirrorWindowController() { | 154 MirrorWindowController::~MirrorWindowController() { |
| 154 // Make sure the root window gets deleted before cursor_window_delegate. | 155 // Make sure the root window gets deleted before cursor_window_delegate. |
| 155 Close(false); | 156 Close(false); |
| 156 } | 157 } |
| 157 | 158 |
| 158 void MirrorWindowController::UpdateWindow( | 159 void MirrorWindowController::UpdateWindow( |
| 159 const std::vector<DisplayInfo>& display_info_list) { | 160 const std::vector<DisplayInfo>& display_info_list) { |
| 160 static int mirror_host_count = 0; | 161 static int mirror_host_count = 0; |
| 161 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 162 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 162 const gfx::Display& primary = Shell::GetScreen()->GetPrimaryDisplay(); | 163 const gfx::Display& primary = gfx::Screen::GetScreen()->GetPrimaryDisplay(); |
| 163 const DisplayInfo& source_display_info = | 164 const DisplayInfo& source_display_info = |
| 164 display_manager->GetDisplayInfo(primary.id()); | 165 display_manager->GetDisplayInfo(primary.id()); |
| 165 | 166 |
| 166 multi_display_mode_ = GetCurrentMultiDisplayMode(); | 167 multi_display_mode_ = GetCurrentMultiDisplayMode(); |
| 167 | 168 |
| 168 for (const DisplayInfo& display_info : display_info_list) { | 169 for (const DisplayInfo& display_info : display_info_list) { |
| 169 scoped_ptr<RootWindowTransformer> transformer; | 170 scoped_ptr<RootWindowTransformer> transformer; |
| 170 if (display_manager->IsInMirrorMode()) { | 171 if (display_manager->IsInMirrorMode()) { |
| 171 transformer.reset(CreateRootWindowTransformerForMirroredDisplay( | 172 transformer.reset(CreateRootWindowTransformerForMirroredDisplay( |
| 172 source_display_info, display_info)); | 173 source_display_info, display_info)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 DisableInput(host->GetAcceleratedWidget()); | 208 DisableInput(host->GetAcceleratedWidget()); |
| 208 #endif | 209 #endif |
| 209 | 210 |
| 210 #if defined(OS_CHROMEOS) | 211 #if defined(OS_CHROMEOS) |
| 211 if (display_manager->IsInUnifiedMode()) { | 212 if (display_manager->IsInUnifiedMode()) { |
| 212 host_info->ash_host->ConfineCursorToRootWindow(); | 213 host_info->ash_host->ConfineCursorToRootWindow(); |
| 213 AshWindowTreeHost* unified_ash_host = | 214 AshWindowTreeHost* unified_ash_host = |
| 214 Shell::GetInstance() | 215 Shell::GetInstance() |
| 215 ->window_tree_host_manager() | 216 ->window_tree_host_manager() |
| 216 ->GetAshWindowTreeHostForDisplayId( | 217 ->GetAshWindowTreeHostForDisplayId( |
| 217 Shell::GetScreen()->GetPrimaryDisplay().id()); | 218 gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); |
| 218 unified_ash_host->RegisterMirroringHost(host_info->ash_host.get()); | 219 unified_ash_host->RegisterMirroringHost(host_info->ash_host.get()); |
| 219 aura::client::SetScreenPositionClient(host->window(), | 220 aura::client::SetScreenPositionClient(host->window(), |
| 220 screen_position_client_.get()); | 221 screen_position_client_.get()); |
| 221 } | 222 } |
| 222 #endif | 223 #endif |
| 223 | 224 |
| 224 aura::client::SetCaptureClient(host->window(), new NoneCaptureClient()); | 225 aura::client::SetCaptureClient(host->window(), new NoneCaptureClient()); |
| 225 host->Show(); | 226 host->Show(); |
| 226 | 227 |
| 227 aura::Window* mirror_window = host_info->mirror_window = | 228 aura::Window* mirror_window = host_info->mirror_window = |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 // EventProcessor may be accessed after this call if the mirroring window | 378 // EventProcessor may be accessed after this call if the mirroring window |
| 378 // was deleted as a result of input event (e.g. shortcut), so don't delete | 379 // was deleted as a result of input event (e.g. shortcut), so don't delete |
| 379 // now. | 380 // now. |
| 380 if (delay_host_deletion) | 381 if (delay_host_deletion) |
| 381 base::MessageLoop::current()->DeleteSoon(FROM_HERE, host_info); | 382 base::MessageLoop::current()->DeleteSoon(FROM_HERE, host_info); |
| 382 else | 383 else |
| 383 delete host_info; | 384 delete host_info; |
| 384 } | 385 } |
| 385 | 386 |
| 386 } // namespace ash | 387 } // namespace ash |
| OLD | NEW |