OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef ASH_HOST_TRANSFORMER_HELPER_H_ | 5 #ifndef ASH_HOST_TRANSFORMER_HELPER_H_ |
6 #define ASH_HOST_TRANSFORMER_HELPER_H_ | 6 #define ASH_HOST_TRANSFORMER_HELPER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 | 9 |
10 namespace gfx { | 10 namespace gfx { |
11 class Insets; | 11 class Insets; |
12 class Size; | 12 class Size; |
13 class Transform; | 13 class Transform; |
14 } | 14 } |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 class AshWindowTreeHost; | 17 class AshWindowTreeHost; |
18 class RootWindowTransformer; | 18 class RootWindowTransformer; |
19 | 19 |
20 // A helper class to handle ash specific feature that requires | 20 // A helper class to handle ash specific feature that requires |
21 // transforming a root window (such as rotation, UI zooming). | 21 // transforming a root window (such as rotation, UI zooming). |
22 class TransformerHelper { | 22 class TransformerHelper { |
23 public: | 23 public: |
24 explicit TransformerHelper(AshWindowTreeHost* ash_host); | 24 explicit TransformerHelper(AshWindowTreeHost* ash_host); |
25 ~TransformerHelper(); | 25 ~TransformerHelper(); |
26 | 26 |
| 27 // Initializes the transformer with identity transform. |
| 28 void Init(); |
| 29 |
27 // Returns the the insets that specifies the effective root window | 30 // Returns the the insets that specifies the effective root window |
28 // area within the host window. | 31 // area within the host window. |
29 gfx::Insets GetHostInsets() const; | 32 gfx::Insets GetHostInsets() const; |
30 | 33 |
31 // Sets a simple transform with no host insets. | 34 // Sets a simple transform with no host insets. |
32 void SetTransform(const gfx::Transform& transform); | 35 void SetTransform(const gfx::Transform& transform); |
33 | 36 |
34 // Sets a RootWindowTransformer which takes the insets into account. | 37 // Sets a RootWindowTransformer which takes the insets into account. |
35 void SetRootWindowTransformer(scoped_ptr<RootWindowTransformer> transformer); | 38 void SetRootWindowTransformer(scoped_ptr<RootWindowTransformer> transformer); |
36 | 39 |
37 // Returns the transforms applied to the root window. | 40 // Returns the transforms applied to the root window. |
38 gfx::Transform GetTransform() const; | 41 gfx::Transform GetTransform() const; |
39 gfx::Transform GetInverseTransform() const; | 42 gfx::Transform GetInverseTransform() const; |
40 | 43 |
41 // Updates the root window size based on the host size and | 44 // Updates the root window size based on the host size and |
42 // current transform. | 45 // current transform. |
43 void UpdateWindowSize(const gfx::Size& host_size); | 46 void UpdateWindowSize(const gfx::Size& host_size); |
44 | 47 |
45 private: | 48 private: |
46 AshWindowTreeHost* ash_host_; | 49 AshWindowTreeHost* ash_host_; |
47 scoped_ptr<RootWindowTransformer> transformer_; | 50 scoped_ptr<RootWindowTransformer> transformer_; |
48 | 51 |
49 DISALLOW_COPY_AND_ASSIGN(TransformerHelper); | 52 DISALLOW_COPY_AND_ASSIGN(TransformerHelper); |
50 }; | 53 }; |
51 | 54 |
52 } // namespace ash | 55 } // namespace ash |
53 | 56 |
54 #endif // ASH_HOST_TRANSFORMER_HELPER_H_ | 57 #endif // ASH_HOST_TRANSFORMER_HELPER_H_ |
OLD | NEW |