OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_COMPOSITOR_LAYER_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_H_ |
6 #define UI_COMPOSITOR_LAYER_H_ | 6 #define UI_COMPOSITOR_LAYER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 18 #include "base/observer_list.h" |
18 #include "cc/base/region.h" | 19 #include "cc/base/region.h" |
19 #include "cc/layers/content_layer_client.h" | 20 #include "cc/layers/content_layer_client.h" |
20 #include "cc/layers/layer_client.h" | 21 #include "cc/layers/layer_client.h" |
21 #include "cc/layers/surface_layer.h" | 22 #include "cc/layers/surface_layer.h" |
22 #include "cc/layers/texture_layer_client.h" | 23 #include "cc/layers/texture_layer_client.h" |
23 #include "cc/resources/texture_mailbox.h" | 24 #include "cc/resources/texture_mailbox.h" |
24 #include "cc/surfaces/surface_id.h" | 25 #include "cc/surfaces/surface_id.h" |
25 #include "third_party/skia/include/core/SkColor.h" | 26 #include "third_party/skia/include/core/SkColor.h" |
26 #include "third_party/skia/include/core/SkRegion.h" | 27 #include "third_party/skia/include/core/SkRegion.h" |
27 #include "ui/compositor/compositor.h" | 28 #include "ui/compositor/compositor.h" |
(...skipping 16 matching lines...) Expand all Loading... |
44 class SurfaceLayer; | 45 class SurfaceLayer; |
45 class TextureLayer; | 46 class TextureLayer; |
46 struct ReturnedResource; | 47 struct ReturnedResource; |
47 typedef std::vector<ReturnedResource> ReturnedResourceArray; | 48 typedef std::vector<ReturnedResource> ReturnedResourceArray; |
48 } | 49 } |
49 | 50 |
50 namespace ui { | 51 namespace ui { |
51 | 52 |
52 class Compositor; | 53 class Compositor; |
53 class LayerAnimator; | 54 class LayerAnimator; |
| 55 class LayerObserver; |
54 class LayerOwner; | 56 class LayerOwner; |
55 class LayerThreadedAnimationDelegate; | 57 class LayerThreadedAnimationDelegate; |
56 | 58 |
57 // Layer manages a texture, transform and a set of child Layers. Any View that | 59 // Layer manages a texture, transform and a set of child Layers. Any View that |
58 // has enabled layers ends up creating a Layer to manage the texture. | 60 // has enabled layers ends up creating a Layer to manage the texture. |
59 // A Layer can also be created without a texture, in which case it renders | 61 // A Layer can also be created without a texture, in which case it renders |
60 // nothing and is simply used as a node in a hierarchy of layers. | 62 // nothing and is simply used as a node in a hierarchy of layers. |
61 // Coordinate system used in layers is DIP (Density Independent Pixel) | 63 // Coordinate system used in layers is DIP (Density Independent Pixel) |
62 // coordinates unless explicitly mentioned as pixel coordinates. | 64 // coordinates unless explicitly mentioned as pixel coordinates. |
63 // | 65 // |
(...skipping 22 matching lines...) Expand all Loading... |
86 // only ever be called on the root layer. | 88 // only ever be called on the root layer. |
87 void SetCompositor(Compositor* compositor, | 89 void SetCompositor(Compositor* compositor, |
88 scoped_refptr<cc::Layer> root_layer); | 90 scoped_refptr<cc::Layer> root_layer); |
89 void ResetCompositor(); | 91 void ResetCompositor(); |
90 | 92 |
91 LayerDelegate* delegate() { return delegate_; } | 93 LayerDelegate* delegate() { return delegate_; } |
92 void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; } | 94 void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; } |
93 | 95 |
94 LayerOwner* owner() { return owner_; } | 96 LayerOwner* owner() { return owner_; } |
95 | 97 |
| 98 void AddObserver(LayerObserver* observer); |
| 99 void RemoveObserver(LayerObserver* observer); |
| 100 |
96 // Adds a new Layer to this Layer. | 101 // Adds a new Layer to this Layer. |
97 void Add(Layer* child); | 102 void Add(Layer* child); |
98 | 103 |
99 // Removes a Layer from this Layer. | 104 // Removes a Layer from this Layer. |
100 void Remove(Layer* child); | 105 void Remove(Layer* child); |
101 | 106 |
102 // Stacks |child| above all other children. | 107 // Stacks |child| above all other children. |
103 void StackAtTop(Layer* child); | 108 void StackAtTop(Layer* child); |
104 | 109 |
105 // Stacks |child| directly above |other|. Both must be children of this | 110 // Stacks |child| directly above |other|. Both must be children of this |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 // Width of the border in pixels, where the scaling is blended. | 485 // Width of the border in pixels, where the scaling is blended. |
481 int zoom_inset_; | 486 int zoom_inset_; |
482 | 487 |
483 // Shape of the window. | 488 // Shape of the window. |
484 std::unique_ptr<SkRegion> alpha_shape_; | 489 std::unique_ptr<SkRegion> alpha_shape_; |
485 | 490 |
486 std::string name_; | 491 std::string name_; |
487 | 492 |
488 LayerDelegate* delegate_; | 493 LayerDelegate* delegate_; |
489 | 494 |
| 495 base::ObserverList<LayerObserver> observer_list_; |
| 496 |
490 LayerOwner* owner_; | 497 LayerOwner* owner_; |
491 | 498 |
492 scoped_refptr<LayerAnimator> animator_; | 499 scoped_refptr<LayerAnimator> animator_; |
493 | 500 |
494 // Ownership of the layer is held through one of the strongly typed layer | 501 // Ownership of the layer is held through one of the strongly typed layer |
495 // pointers, depending on which sort of layer this is. | 502 // pointers, depending on which sort of layer this is. |
496 scoped_refptr<cc::Layer> content_layer_; | 503 scoped_refptr<cc::Layer> content_layer_; |
497 scoped_refptr<cc::NinePatchLayer> nine_patch_layer_; | 504 scoped_refptr<cc::NinePatchLayer> nine_patch_layer_; |
498 scoped_refptr<cc::TextureLayer> texture_layer_; | 505 scoped_refptr<cc::TextureLayer> texture_layer_; |
499 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; | 506 scoped_refptr<cc::SolidColorLayer> solid_color_layer_; |
(...skipping 18 matching lines...) Expand all Loading... |
518 // The size of the frame or texture in DIP, set when SetShowDelegatedContent | 525 // The size of the frame or texture in DIP, set when SetShowDelegatedContent |
519 // or SetTextureMailbox was called. | 526 // or SetTextureMailbox was called. |
520 gfx::Size frame_size_in_dip_; | 527 gfx::Size frame_size_in_dip_; |
521 | 528 |
522 DISALLOW_COPY_AND_ASSIGN(Layer); | 529 DISALLOW_COPY_AND_ASSIGN(Layer); |
523 }; | 530 }; |
524 | 531 |
525 } // namespace ui | 532 } // namespace ui |
526 | 533 |
527 #endif // UI_COMPOSITOR_LAYER_H_ | 534 #endif // UI_COMPOSITOR_LAYER_H_ |
OLD | NEW |