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

Side by Side Diff: ui/aura_shell/shelf_layout_manager.h

Issue 8743014: [cros, Aura] Refresh status area widget bounds on StatusAreaView layout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 9 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_ 5 #ifndef UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_
6 #define UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_ 6 #define UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "ui/aura/layout_manager.h"
11 #include "ui/gfx/compositor/layer_animation_observer.h" 12 #include "ui/gfx/compositor/layer_animation_observer.h"
12 #include "ui/gfx/insets.h" 13 #include "ui/gfx/insets.h"
13 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
14 15
15 namespace views { 16 namespace views {
16 class Widget; 17 class Widget;
17 } 18 }
18 19
19 namespace aura_shell { 20 namespace aura_shell {
20 namespace internal { 21 namespace internal {
21 22
22 // ShelfLayoutController is responsible for showing and hiding the launcher and 23 // ShelfLayoutManager is a layout manager responsible for showing and hiding
23 // status area as well as positioning them. 24 // the launcher and status area as well as positioning them.
24 class ShelfLayoutController : public ui::LayerAnimationObserver { 25 class ShelfLayoutManager : public aura::LayoutManager,
26 public ui::LayerAnimationObserver {
25 public: 27 public:
26 ShelfLayoutController(views::Widget* launcher, 28 ShelfLayoutManager(views::Widget* launcher,
27 views::Widget* status); 29 views::Widget* status);
sky 2011/12/02 19:25:53 nit: update indentation
Nikita (slow) 2011/12/05 14:41:46 Done.
28 virtual ~ShelfLayoutController(); 30 virtual ~ShelfLayoutManager();
29
30 // Stops any animations and sets the bounds of the launcher and status
31 // widgets.
32 void LayoutShelf();
33 31
34 // Sets the visbility of the shelf to |visible|. 32 // Sets the visbility of the shelf to |visible|.
35 void SetVisible(bool visible); 33 void SetVisible(bool visible);
36 34
35 // Overridden from aura::LayoutManager:
36 virtual void OnWindowResized() OVERRIDE;
37 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
38 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
39 virtual void OnChildWindowVisibilityChanged(aura::Window* child,
40 bool visible) OVERRIDE;
41 virtual void SetChildBounds(aura::Window* child,
42 const gfx::Rect& requested_bounds) OVERRIDE;
43
37 private: 44 private:
38 struct TargetBounds { 45 struct TargetBounds {
39 gfx::Rect launcher_bounds; 46 gfx::Rect launcher_bounds;
40 gfx::Rect status_bounds; 47 gfx::Rect status_bounds;
41 gfx::Insets work_area_insets; 48 gfx::Insets work_area_insets;
42 }; 49 };
43 50
51 // Stops any animations and sets the bounds of the launcher and status
52 // widgets.
53 void LayoutShelf();
54
44 // Stops any animations. 55 // Stops any animations.
45 void StopAnimating(); 56 void StopAnimating();
46 57
47 // Calculates the target bounds assuming visibility of |visibile|. 58 // Calculates the target bounds assuming visibility of |visibile|.
48 void CalculateTargetBounds(bool visible, 59 void CalculateTargetBounds(bool visible,
49 TargetBounds* target_bounds); 60 TargetBounds* target_bounds);
50 61
51 // Animates |widget| to the specified bounds and opacity. 62 // Animates |widget| to the specified bounds and opacity.
52 void AnimateWidgetTo(views::Widget* widget, 63 void AnimateWidgetTo(views::Widget* widget,
53 const gfx::Rect& target_bounds, 64 const gfx::Rect& target_bounds,
54 float target_opacity); 65 float target_opacity);
55 66
56 // LayerAnimationObserver overrides: 67 // LayerAnimationObserver overrides:
57 virtual void OnLayerAnimationEnded( 68 virtual void OnLayerAnimationEnded(
58 const ui::LayerAnimationSequence* sequence) OVERRIDE; 69 const ui::LayerAnimationSequence* sequence) OVERRIDE;
59 virtual void OnLayerAnimationAborted( 70 virtual void OnLayerAnimationAborted(
60 const ui::LayerAnimationSequence* sequence) OVERRIDE {} 71 const ui::LayerAnimationSequence* sequence) OVERRIDE {}
61 virtual void OnLayerAnimationScheduled( 72 virtual void OnLayerAnimationScheduled(
62 const ui::LayerAnimationSequence* sequence) OVERRIDE {} 73 const ui::LayerAnimationSequence* sequence) OVERRIDE {}
63 74
64 // Are we animating? 75 // Are we animating?
65 bool animating_; 76 bool animating_;
66 77
78 // True when inside LayoutShelf method. Used to prevent calling LayoutShelf
79 // again from SetChildBounds().
80 bool in_layout_;
81
67 // Current visibility. When the visibility changes this field is reset once 82 // Current visibility. When the visibility changes this field is reset once
68 // the animation completes. 83 // the animation completes.
69 bool visible_; 84 bool visible_;
70 85
71 // Max height needed. 86 // Max height needed.
72 int max_height_; 87 int max_height_;
73 88
74 views::Widget* launcher_; 89 views::Widget* launcher_;
75 views::Widget* status_; 90 views::Widget* status_;
76 91
77 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutController); 92 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager);
78 }; 93 };
79 94
80 } // namespace internal 95 } // namespace internal
81 } // namespace aura_shell 96 } // namespace aura_shell
82 97
83 #endif // UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_ 98 #endif // UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698