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