Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: ui/compositor/layer.h

Issue 184983005: Remove Views dependency from window_animations.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/window.cc ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 29 matching lines...) Expand all
40 class SolidColorLayer; 40 class SolidColorLayer;
41 class TextureLayer; 41 class TextureLayer;
42 struct ReturnedResource; 42 struct ReturnedResource;
43 typedef std::vector<ReturnedResource> ReturnedResourceArray; 43 typedef std::vector<ReturnedResource> ReturnedResourceArray;
44 } 44 }
45 45
46 namespace ui { 46 namespace ui {
47 47
48 class Compositor; 48 class Compositor;
49 class LayerAnimator; 49 class LayerAnimator;
50 class LayerOwner;
50 class Texture; 51 class Texture;
51 52
52 // Layer manages a texture, transform and a set of child Layers. Any View that 53 // Layer manages a texture, transform and a set of child Layers. Any View that
53 // has enabled layers ends up creating a Layer to manage the texture. 54 // has enabled layers ends up creating a Layer to manage the texture.
54 // A Layer can also be created without a texture, in which case it renders 55 // A Layer can also be created without a texture, in which case it renders
55 // nothing and is simply used as a node in a hierarchy of layers. 56 // nothing and is simply used as a node in a hierarchy of layers.
56 // Coordinate system used in layers is DIP (Density Independent Pixel) 57 // Coordinate system used in layers is DIP (Density Independent Pixel)
57 // coordinates unless explicitly mentioned as pixel coordinates. 58 // coordinates unless explicitly mentioned as pixel coordinates.
58 // 59 //
59 // NOTE: Unlike Views, each Layer does *not* own its child Layers. If you 60 // NOTE: Unlike Views, each Layer does *not* own its child Layers. If you
(...skipping 14 matching lines...) Expand all
74 // to locate it. Returns NULL if the Layer is not attached to a compositor. 75 // to locate it. Returns NULL if the Layer is not attached to a compositor.
75 Compositor* GetCompositor(); 76 Compositor* GetCompositor();
76 77
77 // Called by the compositor when the Layer is set as its root Layer. This can 78 // Called by the compositor when the Layer is set as its root Layer. This can
78 // only ever be called on the root layer. 79 // only ever be called on the root layer.
79 void SetCompositor(Compositor* compositor); 80 void SetCompositor(Compositor* compositor);
80 81
81 LayerDelegate* delegate() { return delegate_; } 82 LayerDelegate* delegate() { return delegate_; }
82 void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; } 83 void set_delegate(LayerDelegate* delegate) { delegate_ = delegate; }
83 84
85 LayerOwner* owner() { return owner_; }
86
84 // Adds a new Layer to this Layer. 87 // Adds a new Layer to this Layer.
85 void Add(Layer* child); 88 void Add(Layer* child);
86 89
87 // Removes a Layer from this Layer. 90 // Removes a Layer from this Layer.
88 void Remove(Layer* child); 91 void Remove(Layer* child);
89 92
90 // Stacks |child| above all other children. 93 // Stacks |child| above all other children.
91 void StackAtTop(Layer* child); 94 void StackAtTop(Layer* child);
92 95
93 // Stacks |child| directly above |other|. Both must be children of this 96 // Stacks |child| directly above |other|. Both must be children of this
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 342
340 // Whether this layer has animations waiting to get sent to its cc::Layer. 343 // Whether this layer has animations waiting to get sent to its cc::Layer.
341 bool HasPendingThreadedAnimations() { 344 bool HasPendingThreadedAnimations() {
342 return pending_threaded_animations_.size() != 0; 345 return pending_threaded_animations_.size() != 0;
343 } 346 }
344 347
345 // Triggers a call to SwitchToLayer. 348 // Triggers a call to SwitchToLayer.
346 void SwitchCCLayerForTest(); 349 void SwitchCCLayerForTest();
347 350
348 private: 351 private:
352 friend class LayerOwner;
353
349 // Stacks |child| above or below |other|. Helper method for StackAbove() and 354 // Stacks |child| above or below |other|. Helper method for StackAbove() and
350 // StackBelow(). 355 // StackBelow().
351 void StackRelativeTo(Layer* child, Layer* other, bool above); 356 void StackRelativeTo(Layer* child, Layer* other, bool above);
352 357
353 bool ConvertPointForAncestor(const Layer* ancestor, gfx::Point* point) const; 358 bool ConvertPointForAncestor(const Layer* ancestor, gfx::Point* point) const;
354 bool ConvertPointFromAncestor(const Layer* ancestor, gfx::Point* point) const; 359 bool ConvertPointFromAncestor(const Layer* ancestor, gfx::Point* point) const;
355 360
356 // Implementation of LayerAnimatorDelegate 361 // Implementation of LayerAnimatorDelegate
357 virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE; 362 virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE;
358 virtual void SetTransformFromAnimation( 363 virtual void SetTransformFromAnimation(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 // set to 1. 447 // set to 1.
443 float zoom_; 448 float zoom_;
444 449
445 // Width of the border in pixels, where the scaling is blended. 450 // Width of the border in pixels, where the scaling is blended.
446 int zoom_inset_; 451 int zoom_inset_;
447 452
448 std::string name_; 453 std::string name_;
449 454
450 LayerDelegate* delegate_; 455 LayerDelegate* delegate_;
451 456
457 LayerOwner* owner_;
458
452 scoped_refptr<LayerAnimator> animator_; 459 scoped_refptr<LayerAnimator> animator_;
453 460
454 // Animations that are passed to AddThreadedAnimation before this layer is 461 // Animations that are passed to AddThreadedAnimation before this layer is
455 // added to a tree. 462 // added to a tree.
456 cc::ScopedPtrVector<cc::Animation> pending_threaded_animations_; 463 cc::ScopedPtrVector<cc::Animation> pending_threaded_animations_;
457 464
458 // Ownership of the layer is held through one of the strongly typed layer 465 // Ownership of the layer is held through one of the strongly typed layer
459 // pointers, depending on which sort of layer this is. 466 // pointers, depending on which sort of layer this is.
460 scoped_refptr<cc::ContentLayer> content_layer_; 467 scoped_refptr<cc::ContentLayer> content_layer_;
461 scoped_refptr<cc::TextureLayer> texture_layer_; 468 scoped_refptr<cc::TextureLayer> texture_layer_;
(...skipping 17 matching lines...) Expand all
479 // The size of the delegated frame in DIP, set when SetShowDelegatedContent 486 // The size of the delegated frame in DIP, set when SetShowDelegatedContent
480 // was called. 487 // was called.
481 gfx::Size delegated_frame_size_in_dip_; 488 gfx::Size delegated_frame_size_in_dip_;
482 489
483 DISALLOW_COPY_AND_ASSIGN(Layer); 490 DISALLOW_COPY_AND_ASSIGN(Layer);
484 }; 491 };
485 492
486 } // namespace ui 493 } // namespace ui
487 494
488 #endif // UI_COMPOSITOR_LAYER_H_ 495 #endif // UI_COMPOSITOR_LAYER_H_
OLDNEW
« no previous file with comments | « ui/aura/window.cc ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698