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 | 9 |
10 // Xlib.h defines RootWindow. | 10 // Xlib.h defines RootWindow. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 virtual aura::Window* GetGlobalCaptureWindow() OVERRIDE { | 66 virtual aura::Window* GetGlobalCaptureWindow() OVERRIDE { |
67 return NULL; | 67 return NULL; |
68 } | 68 } |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(NoneCaptureClient); | 70 DISALLOW_COPY_AND_ASSIGN(NoneCaptureClient); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace | 73 } // namespace |
74 | 74 |
75 MirrorWindowController::MirrorWindowController() {} | 75 MirrorWindowController::MirrorWindowController( |
| 76 ui::ContextFactory* context_factory) |
| 77 : context_factory_(context_factory) {} |
76 | 78 |
77 MirrorWindowController::~MirrorWindowController() { | 79 MirrorWindowController::~MirrorWindowController() { |
78 // Make sure the root window gets deleted before cursor_window_delegate. | 80 // Make sure the root window gets deleted before cursor_window_delegate. |
79 Close(); | 81 Close(); |
80 } | 82 } |
81 | 83 |
82 void MirrorWindowController::UpdateWindow(const DisplayInfo& display_info) { | 84 void MirrorWindowController::UpdateWindow(const DisplayInfo& display_info) { |
83 static int mirror_host_count = 0; | 85 static int mirror_host_count = 0; |
84 if (!ash_host_.get()) { | 86 if (!ash_host_.get()) { |
85 AshWindowTreeHostInitParams init_params; | 87 AshWindowTreeHostInitParams init_params; |
86 init_params.initial_bounds = display_info.bounds_in_native(); | 88 init_params.initial_bounds = display_info.bounds_in_native(); |
| 89 init_params.context_factory = context_factory_; |
87 ash_host_.reset(AshWindowTreeHost::Create(init_params)); | 90 ash_host_.reset(AshWindowTreeHost::Create(init_params)); |
88 aura::WindowTreeHost* host = ash_host_->AsWindowTreeHost(); | 91 aura::WindowTreeHost* host = ash_host_->AsWindowTreeHost(); |
89 host->window()->SetName( | 92 host->window()->SetName( |
90 base::StringPrintf("MirrorRootWindow-%d", mirror_host_count++)); | 93 base::StringPrintf("MirrorRootWindow-%d", mirror_host_count++)); |
91 host->compositor()->SetBackgroundColor(SK_ColorBLACK); | 94 host->compositor()->SetBackgroundColor(SK_ColorBLACK); |
92 // No need to remove the observer because the DisplayController outlives the | 95 // No need to remove the observer because the DisplayController outlives the |
93 // host. | 96 // host. |
94 host->AddObserver(Shell::GetInstance()->display_controller()); | 97 host->AddObserver(Shell::GetInstance()->display_controller()); |
95 host->AddObserver(this); | 98 host->AddObserver(this); |
96 // TODO(oshima): TouchHUD is using idkey. | 99 // TODO(oshima): TouchHUD is using idkey. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 display_manager->mirrored_display_id()); | 177 display_manager->mirrored_display_id()); |
175 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( | 178 const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( |
176 Shell::GetScreen()->GetPrimaryDisplay().id()); | 179 Shell::GetScreen()->GetPrimaryDisplay().id()); |
177 DCHECK(display_manager->IsMirrored()); | 180 DCHECK(display_manager->IsMirrored()); |
178 return scoped_ptr<RootWindowTransformer>( | 181 return scoped_ptr<RootWindowTransformer>( |
179 CreateRootWindowTransformerForMirroredDisplay(source_display_info, | 182 CreateRootWindowTransformerForMirroredDisplay(source_display_info, |
180 mirror_display_info)); | 183 mirror_display_info)); |
181 } | 184 } |
182 | 185 |
183 } // namespace ash | 186 } // namespace ash |
OLD | NEW |