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

Side by Side Diff: ui/aura_shell/shelf_layout_controller.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: add separate layout manager for status area 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_
6 #define UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "ui/gfx/compositor/layer_animation_observer.h"
12 #include "ui/gfx/insets.h"
13 #include "ui/gfx/rect.h"
14
15 namespace views {
16 class Widget;
17 }
18
19 namespace aura_shell {
20 namespace internal {
21
22 // ShelfLayoutController is responsible for showing and hiding the launcher and
23 // status area as well as positioning them.
24 class ShelfLayoutController : public ui::LayerAnimationObserver {
25 public:
26 ShelfLayoutController(views::Widget* launcher,
27 views::Widget* status);
28 virtual ~ShelfLayoutController();
29
30 // Stops any animations and sets the bounds of the launcher and status
31 // widgets.
32 void LayoutShelf();
33
34 // Sets the visbility of the shelf to |visible|.
35 void SetVisible(bool visible);
36
37 private:
38 struct TargetBounds {
39 gfx::Rect launcher_bounds;
40 gfx::Rect status_bounds;
41 gfx::Insets work_area_insets;
42 };
43
44 // Stops any animations.
45 void StopAnimating();
46
47 // Calculates the target bounds assuming visibility of |visibile|.
48 void CalculateTargetBounds(bool visible,
49 TargetBounds* target_bounds);
50
51 // Animates |widget| to the specified bounds and opacity.
52 void AnimateWidgetTo(views::Widget* widget,
53 const gfx::Rect& target_bounds,
54 float target_opacity);
55
56 // LayerAnimationObserver overrides:
57 virtual void OnLayerAnimationEnded(
58 const ui::LayerAnimationSequence* sequence) OVERRIDE;
59 virtual void OnLayerAnimationAborted(
60 const ui::LayerAnimationSequence* sequence) OVERRIDE {}
61 virtual void OnLayerAnimationScheduled(
62 const ui::LayerAnimationSequence* sequence) OVERRIDE {}
63
64 // Are we animating?
65 bool animating_;
66
67 // Current visibility. When the visibility changes this field is reset once
68 // the animation completes.
69 bool visible_;
70
71 // Max height needed.
72 int max_height_;
73
74 views::Widget* launcher_;
75 views::Widget* status_;
76
77 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutController);
78 };
79
80 } // namespace internal
81 } // namespace aura_shell
82
83 #endif // UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698