Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / ash / host / ash_window_tree_host_ozone.cc
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.
4
5 #include "ash/host/ash_window_tree_host.h"
6
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"
14
15 namespace ash {
16 namespace {
17
18 class AshWindowTreeHostOzone : public AshWindowTreeHost,
19                                public aura::WindowTreeHostOzone {
20  public:
21   explicit AshWindowTreeHostOzone(const gfx::Rect& initial_bounds);
22   virtual ~AshWindowTreeHostOzone();
23
24  private:
25   // AshWindowTreeHost:
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;
37
38   TransformerHelper transformer_helper_;
39
40   DISALLOW_COPY_AND_ASSIGN(AshWindowTreeHostOzone);
41 };
42
43 AshWindowTreeHostOzone::AshWindowTreeHostOzone(const gfx::Rect& initial_bounds)
44     : aura::WindowTreeHostOzone(initial_bounds),
45       transformer_helper_(this) {}
46
47 AshWindowTreeHostOzone::~AshWindowTreeHostOzone() {}
48
49 void AshWindowTreeHostOzone::ToggleFullScreen() {
50   NOTIMPLEMENTED();
51 }
52
53 bool AshWindowTreeHostOzone::ConfineCursorToRootWindow() {
54   return false;
55 }
56
57 void AshWindowTreeHostOzone::UnConfineCursor() {
58   NOTIMPLEMENTED();
59 }
60
61 void AshWindowTreeHostOzone::SetRootWindowTransformer(
62     scoped_ptr<RootWindowTransformer> transformer) {
63   transformer_helper_.SetRootWindowTransformer(transformer.Pass());
64 }
65
66 gfx::Insets AshWindowTreeHostOzone::GetHostInsets() const {
67   return transformer_helper_.GetHostInsets();
68 }
69
70 aura::WindowTreeHost* AshWindowTreeHostOzone::AsWindowTreeHost() {
71   return this;
72 }
73
74 void AshWindowTreeHostOzone::SetRootTransform(const gfx::Transform& transform) {
75   transformer_helper_.SetTransform(transform);
76 }
77
78 gfx::Transform AshWindowTreeHostOzone::GetRootTransform() const {
79   return transformer_helper_.GetTransform();
80 }
81
82 gfx::Transform AshWindowTreeHostOzone::GetInverseRootTransform() const {
83   return transformer_helper_.GetInverseTransform();
84 }
85
86 void AshWindowTreeHostOzone::UpdateRootWindowSize(const gfx::Size& host_size) {
87   transformer_helper_.UpdateWindowSize(host_size);
88 }
89
90 }  // namespace
91
92 AshWindowTreeHost* AshWindowTreeHost::Create(
93     const AshWindowTreeHostInitParams& init_params) {
94   return new AshWindowTreeHostOzone(init_params.initial_bounds);
95 }
96
97 }  // namespace ash