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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ui/aura_shell/shelf_layout_manager.h
diff --git a/ui/aura_shell/shelf_layout_controller.h b/ui/aura_shell/shelf_layout_manager.h
similarity index 61%
rename from ui/aura_shell/shelf_layout_controller.h
rename to ui/aura_shell/shelf_layout_manager.h
index a675699e5e1fa67c97d914d01ba41c82802e4c39..d5a26eb698ed4d0ae265bc3ba97ebc48dd3d227e 100644
--- a/ui/aura_shell/shelf_layout_controller.h
+++ b/ui/aura_shell/shelf_layout_manager.h
@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_
-#define UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_
+#ifndef UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_
+#define UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_
#pragma once
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "ui/aura/layout_manager.h"
#include "ui/gfx/compositor/layer_animation_observer.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/rect.h"
@@ -19,21 +20,27 @@ class Widget;
namespace aura_shell {
namespace internal {
-// ShelfLayoutController is responsible for showing and hiding the launcher and
-// status area as well as positioning them.
-class ShelfLayoutController : public ui::LayerAnimationObserver {
+// ShelfLayoutManager is a layout manager responsible for showing and hiding
+// the launcher and status area as well as positioning them.
+class ShelfLayoutManager : public aura::LayoutManager,
+ public ui::LayerAnimationObserver {
public:
- ShelfLayoutController(views::Widget* launcher,
+ ShelfLayoutManager(views::Widget* launcher,
views::Widget* status);
sky 2011/12/02 19:25:53 nit: update indentation
Nikita (slow) 2011/12/05 14:41:46 Done.
- virtual ~ShelfLayoutController();
-
- // Stops any animations and sets the bounds of the launcher and status
- // widgets.
- void LayoutShelf();
+ virtual ~ShelfLayoutManager();
// Sets the visbility of the shelf to |visible|.
void SetVisible(bool visible);
+ // Overridden from aura::LayoutManager:
+ virtual void OnWindowResized() OVERRIDE;
+ virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
+ virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
+ virtual void OnChildWindowVisibilityChanged(aura::Window* child,
+ bool visible) OVERRIDE;
+ virtual void SetChildBounds(aura::Window* child,
+ const gfx::Rect& requested_bounds) OVERRIDE;
+
private:
struct TargetBounds {
gfx::Rect launcher_bounds;
@@ -41,6 +48,10 @@ class ShelfLayoutController : public ui::LayerAnimationObserver {
gfx::Insets work_area_insets;
};
+ // Stops any animations and sets the bounds of the launcher and status
+ // widgets.
+ void LayoutShelf();
+
// Stops any animations.
void StopAnimating();
@@ -64,6 +75,10 @@ class ShelfLayoutController : public ui::LayerAnimationObserver {
// Are we animating?
bool animating_;
+ // True when inside LayoutShelf method. Used to prevent calling LayoutShelf
+ // again from SetChildBounds().
+ bool in_layout_;
+
// Current visibility. When the visibility changes this field is reset once
// the animation completes.
bool visible_;
@@ -74,10 +89,10 @@ class ShelfLayoutController : public ui::LayerAnimationObserver {
views::Widget* launcher_;
views::Widget* status_;
- DISALLOW_COPY_AND_ASSIGN(ShelfLayoutController);
+ DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager);
};
} // namespace internal
} // namespace aura_shell
-#endif // UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_
+#endif // UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698