1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/host/ash_window_tree_host.h"
7 #include "ash/host/ash_window_tree_host_init_params.h"
8 #include "ash/host/root_window_transformer.h"
9 #include "ash/host/transformer_helper.h"
10 #include "base/command_line.h"
11 #include "ui/aura/window_tree_host_ozone.h"
12 #include "ui/gfx/geometry/insets.h"
13 #include "ui/gfx/transform.h"
18 class AshWindowTreeHostOzone
: public AshWindowTreeHost
,
19 public aura::WindowTreeHostOzone
{
21 explicit AshWindowTreeHostOzone(const gfx::Rect
& initial_bounds
);
22 virtual ~AshWindowTreeHostOzone();
26 virtual void ToggleFullScreen() OVERRIDE
;
27 virtual bool ConfineCursorToRootWindow() OVERRIDE
;
28 virtual void UnConfineCursor() OVERRIDE
;
29 virtual void SetRootWindowTransformer(
30 scoped_ptr
<RootWindowTransformer
> transformer
) OVERRIDE
;
31 virtual gfx::Insets
GetHostInsets() const OVERRIDE
;
32 virtual aura::WindowTreeHost
* AsWindowTreeHost() OVERRIDE
;
33 virtual void SetRootTransform(const gfx::Transform
& transform
) OVERRIDE
;
34 virtual gfx::Transform
GetRootTransform() const OVERRIDE
;
35 virtual gfx::Transform
GetInverseRootTransform() const OVERRIDE
;
36 virtual void UpdateRootWindowSize(const gfx::Size
& host_size
) OVERRIDE
;
38 TransformerHelper transformer_helper_
;
40 DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostOzone
);
43 AshWindowTreeHostOzone::AshWindowTreeHostOzone(const gfx::Rect
& initial_bounds
)
44 : aura::WindowTreeHostOzone(initial_bounds
),
45 transformer_helper_(this) {}
47 AshWindowTreeHostOzone::~AshWindowTreeHostOzone() {}
49 void AshWindowTreeHostOzone::ToggleFullScreen() {
53 bool AshWindowTreeHostOzone::ConfineCursorToRootWindow() {
57 void AshWindowTreeHostOzone::UnConfineCursor() {
61 void AshWindowTreeHostOzone::SetRootWindowTransformer(
62 scoped_ptr
<RootWindowTransformer
> transformer
) {
63 transformer_helper_
.SetRootWindowTransformer(transformer
.Pass());
66 gfx::Insets
AshWindowTreeHostOzone::GetHostInsets() const {
67 return transformer_helper_
.GetHostInsets();
70 aura::WindowTreeHost
* AshWindowTreeHostOzone::AsWindowTreeHost() {
74 void AshWindowTreeHostOzone::SetRootTransform(const gfx::Transform
& transform
) {
75 transformer_helper_
.GetTransform();
78 gfx::Transform
AshWindowTreeHostOzone::GetRootTransform() const {
79 return transformer_helper_
.GetTransform();
82 gfx::Transform
AshWindowTreeHostOzone::GetInverseRootTransform() const {
83 return transformer_helper_
.GetInverseTransform();
86 void AshWindowTreeHostOzone::UpdateRootWindowSize(const gfx::Size
& host_size
) {
87 transformer_helper_
.UpdateWindowSize(host_size
);
92 AshWindowTreeHost
* AshWindowTreeHost::Create(
93 const AshWindowTreeHostInitParams
& init_params
) {
94 return new AshWindowTreeHostOzone(init_params
.initial_bounds
);