| Index: ash/display/mirror_window_controller.cc
|
| diff --git a/ash/display/mirror_window_controller.cc b/ash/display/mirror_window_controller.cc
|
| index 69de04273bb62859bcc0823f6e0659b30cf74998..37dcf3bca25657135df57766c82bb2aa921477c9 100644
|
| --- a/ash/display/mirror_window_controller.cc
|
| +++ b/ash/display/mirror_window_controller.cc
|
| @@ -16,14 +16,15 @@
|
| #include "ash/display/display_info.h"
|
| #include "ash/display/display_manager.h"
|
| #include "ash/display/root_window_transformers.h"
|
| -#include "ash/host/window_tree_host_factory.h"
|
| +#include "ash/host/ash_window_tree_host.h"
|
| +#include "ash/host/root_window_transformer.h"
|
| #include "ash/root_window_settings.h"
|
| #include "ash/shell.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "ui/aura/client/capture_client.h"
|
| -#include "ui/aura/root_window_transformer.h"
|
| #include "ui/aura/window_delegate.h"
|
| #include "ui/aura/window_event_dispatcher.h"
|
| +#include "ui/aura/window_tree_host.h"
|
| #include "ui/base/layout.h"
|
| #include "ui/compositor/reflector.h"
|
| #include "ui/gfx/canvas.h"
|
| @@ -79,54 +80,54 @@ MirrorWindowController::~MirrorWindowController() {
|
|
|
| void MirrorWindowController::UpdateWindow(const DisplayInfo& display_info) {
|
| static int mirror_host_count = 0;
|
| -
|
| - if (!host_.get()) {
|
| + if (!ash_host_.get()) {
|
| const gfx::Rect& bounds_in_native = display_info.bounds_in_native();
|
| - host_.reset(Shell::GetInstance()->window_tree_host_factory()->
|
| - CreateWindowTreeHost(bounds_in_native));
|
| - host_->window()->SetName(
|
| + ash_host_.reset(AshWindowTreeHost::Create(bounds_in_native));
|
| + aura::WindowTreeHost* host = ash_host_->AsWindowTreeHost();
|
| + host->window()->SetName(
|
| base::StringPrintf("MirrorRootWindow-%d", mirror_host_count++));
|
| - host_->compositor()->SetBackgroundColor(SK_ColorBLACK);
|
| + host->compositor()->SetBackgroundColor(SK_ColorBLACK);
|
| // No need to remove the observer because the DisplayController outlives the
|
| // host.
|
| - host_->AddObserver(Shell::GetInstance()->display_controller());
|
| - host_->AddObserver(this);
|
| + host->AddObserver(Shell::GetInstance()->display_controller());
|
| + host->AddObserver(this);
|
| // TODO(oshima): TouchHUD is using idkey.
|
| - InitRootWindowSettings(host_->window())->display_id = display_info.id();
|
| - host_->InitHost();
|
| + InitRootWindowSettings(host->window())->display_id = display_info.id();
|
| + host->InitHost();
|
| #if defined(USE_X11)
|
| - DisableInput(host_->GetAcceleratedWidget());
|
| + DisableInput(host->GetAcceleratedWidget());
|
| #endif
|
|
|
| - aura::client::SetCaptureClient(host_->window(), new NoneCaptureClient());
|
| - host_->Show();
|
| + aura::client::SetCaptureClient(host->window(), new NoneCaptureClient());
|
| + host->Show();
|
|
|
| // TODO(oshima): Start mirroring.
|
| aura::Window* mirror_window = new aura::Window(NULL);
|
| mirror_window->Init(aura::WINDOW_LAYER_TEXTURED);
|
| - host_->window()->AddChild(mirror_window);
|
| - mirror_window->SetBounds(host_->window()->bounds());
|
| + host->window()->AddChild(mirror_window);
|
| + mirror_window->SetBounds(host->window()->bounds());
|
| mirror_window->Show();
|
| reflector_ = ui::ContextFactory::GetInstance()->CreateReflector(
|
| Shell::GetPrimaryRootWindow()->GetHost()->compositor(),
|
| mirror_window->layer());
|
| } else {
|
| - GetRootWindowSettings(host_->window())->display_id = display_info.id();
|
| - host_->SetBounds(display_info.bounds_in_native());
|
| + aura::WindowTreeHost* host = ash_host_->AsWindowTreeHost();
|
| + GetRootWindowSettings(host->window())->display_id = display_info.id();
|
| + host->SetBounds(display_info.bounds_in_native());
|
| }
|
|
|
| DisplayManager* display_manager = Shell::GetInstance()->display_manager();
|
| const DisplayInfo& source_display_info = display_manager->GetDisplayInfo(
|
| Shell::GetScreen()->GetPrimaryDisplay().id());
|
| DCHECK(display_manager->IsMirrored());
|
| - scoped_ptr<aura::RootWindowTransformer> transformer(
|
| + scoped_ptr<RootWindowTransformer> transformer(
|
| CreateRootWindowTransformerForMirroredDisplay(source_display_info,
|
| display_info));
|
| - host_->SetRootWindowTransformer(transformer.Pass());
|
| + ash_host_->SetRootWindowTransformer(transformer.Pass());
|
| }
|
|
|
| void MirrorWindowController::UpdateWindow() {
|
| - if (host_.get()) {
|
| + if (ash_host_.get()) {
|
| DisplayManager* display_manager = Shell::GetInstance()->display_manager();
|
| const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo(
|
| display_manager->mirrored_display_id());
|
| @@ -135,17 +136,18 @@ void MirrorWindowController::UpdateWindow() {
|
| }
|
|
|
| void MirrorWindowController::Close() {
|
| - if (host_.get()) {
|
| + if (ash_host_.get()) {
|
| + aura::WindowTreeHost* host = ash_host_->AsWindowTreeHost();
|
| ui::ContextFactory::GetInstance()->RemoveReflector(reflector_);
|
| reflector_ = NULL;
|
| NoneCaptureClient* capture_client = static_cast<NoneCaptureClient*>(
|
| - aura::client::GetCaptureClient(host_->window()));
|
| - aura::client::SetCaptureClient(host_->window(), NULL);
|
| + aura::client::GetCaptureClient(host->window()));
|
| + aura::client::SetCaptureClient(host->window(), NULL);
|
| delete capture_client;
|
|
|
| - host_->RemoveObserver(Shell::GetInstance()->display_controller());
|
| - host_->RemoveObserver(this);
|
| - host_.reset();
|
| + host->RemoveObserver(Shell::GetInstance()->display_controller());
|
| + host->RemoveObserver(this);
|
| + ash_host_.reset();
|
| }
|
| }
|
|
|
| @@ -154,13 +156,16 @@ void MirrorWindowController::OnHostResized(const aura::WindowTreeHost* host) {
|
| return;
|
| mirror_window_host_size_ = host->GetBounds().size();
|
| reflector_->OnMirroringCompositorResized();
|
| - host_->SetRootWindowTransformer(CreateRootWindowTransformer().Pass());
|
| + ash_host_->SetRootWindowTransformer(CreateRootWindowTransformer().Pass());
|
| Shell::GetInstance()->display_controller()->cursor_window_controller()->
|
| UpdateLocation();
|
| }
|
|
|
| +aura::Window* MirrorWindowController::GetWindow() {
|
| + return ash_host_.get() ? ash_host_->AsWindowTreeHost()->window() : NULL;
|
| +}
|
|
|
| -scoped_ptr<aura::RootWindowTransformer>
|
| +scoped_ptr<RootWindowTransformer>
|
| MirrorWindowController::CreateRootWindowTransformer() const {
|
| DisplayManager* display_manager = Shell::GetInstance()->display_manager();
|
| const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo(
|
| @@ -168,7 +173,7 @@ MirrorWindowController::CreateRootWindowTransformer() const {
|
| const DisplayInfo& source_display_info = display_manager->GetDisplayInfo(
|
| Shell::GetScreen()->GetPrimaryDisplay().id());
|
| DCHECK(display_manager->IsMirrored());
|
| - return scoped_ptr<aura::RootWindowTransformer>(
|
| + return scoped_ptr<RootWindowTransformer>(
|
| CreateRootWindowTransformerForMirroredDisplay(source_display_info,
|
| mirror_display_info));
|
| }
|
|
|