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

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

Issue 8819016: [Aura] Refresh status area widget bounds on StatusAreaView layout (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « ui/aura_shell/shelf_layout_controller.cc ('k') | ui/aura_shell/shelf_layout_manager.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) 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 the launcher.
23 // status area as well as positioning them. 24 // Also supports showing and hiding the launcher/status area
24 class ShelfLayoutController : public ui::LayerAnimationObserver { 25 // as well as positioning them.
26 class ShelfLayoutManager : public aura::LayoutManager,
27 public ui::LayerAnimationObserver {
25 public: 28 public:
26 ShelfLayoutController(views::Widget* launcher, 29 ShelfLayoutManager(views::Widget* launcher,
27 views::Widget* status); 30 views::Widget* status);
28 virtual ~ShelfLayoutController(); 31 virtual ~ShelfLayoutManager();
32
33 bool in_layout() const { return in_layout_; }
29 34
30 // Stops any animations and sets the bounds of the launcher and status 35 // Stops any animations and sets the bounds of the launcher and status
31 // widgets. 36 // widgets.
32 void LayoutShelf(); 37 void LayoutShelf();
33 38
34 // Sets the visbility of the shelf to |visible|. 39 // Sets the visbility of the shelf to |visible|.
35 void SetVisible(bool visible); 40 void SetVisible(bool visible);
36 41
42 // Overridden from aura::LayoutManager:
43 virtual void OnWindowResized() OVERRIDE;
44 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
45 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
46 virtual void OnChildWindowVisibilityChanged(aura::Window* child,
47 bool visible) OVERRIDE;
48 virtual void SetChildBounds(aura::Window* child,
49 const gfx::Rect& requested_bounds) OVERRIDE;
50
37 private: 51 private:
38 struct TargetBounds { 52 struct TargetBounds {
39 gfx::Rect launcher_bounds; 53 gfx::Rect launcher_bounds;
40 gfx::Rect status_bounds; 54 gfx::Rect status_bounds;
41 gfx::Insets work_area_insets; 55 gfx::Insets work_area_insets;
42 }; 56 };
43 57
44 // Stops any animations. 58 // Stops any animations.
45 void StopAnimating(); 59 void StopAnimating();
46 60
(...skipping 10 matching lines...) Expand all
57 virtual void OnLayerAnimationEnded( 71 virtual void OnLayerAnimationEnded(
58 const ui::LayerAnimationSequence* sequence) OVERRIDE; 72 const ui::LayerAnimationSequence* sequence) OVERRIDE;
59 virtual void OnLayerAnimationAborted( 73 virtual void OnLayerAnimationAborted(
60 const ui::LayerAnimationSequence* sequence) OVERRIDE {} 74 const ui::LayerAnimationSequence* sequence) OVERRIDE {}
61 virtual void OnLayerAnimationScheduled( 75 virtual void OnLayerAnimationScheduled(
62 const ui::LayerAnimationSequence* sequence) OVERRIDE {} 76 const ui::LayerAnimationSequence* sequence) OVERRIDE {}
63 77
64 // Are we animating? 78 // Are we animating?
65 bool animating_; 79 bool animating_;
66 80
81 // True when inside LayoutShelf method. Used to prevent calling LayoutShelf
82 // again from SetChildBounds().
83 bool in_layout_;
84
67 // Current visibility. When the visibility changes this field is reset once 85 // Current visibility. When the visibility changes this field is reset once
68 // the animation completes. 86 // the animation completes.
69 bool visible_; 87 bool visible_;
70 88
71 // Max height needed. 89 // Max height needed.
72 int max_height_; 90 int max_height_;
73 91
74 views::Widget* launcher_; 92 views::Widget* launcher_;
75 views::Widget* status_; 93 views::Widget* status_;
76 94
77 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutController); 95 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager);
78 }; 96 };
79 97
80 } // namespace internal 98 } // namespace internal
81 } // namespace aura_shell 99 } // namespace aura_shell
82 100
83 #endif // UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_ 101 #endif // UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/aura_shell/shelf_layout_controller.cc ('k') | ui/aura_shell/shelf_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698