Home | History | Annotate | Download | only in wm
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef ASH_WM_STATUS_AREA_LAYOUT_MANAGER_H_
      6 #define ASH_WM_STATUS_AREA_LAYOUT_MANAGER_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/compiler_specific.h"
     10 #include "ui/aura/layout_manager.h"
     11 
     12 namespace ash {
     13 class ShelfWidget;
     14 namespace internal {
     15 
     16 // StatusAreaLayoutManager is a layout manager responsible for the status area.
     17 // In any case when status area needs relayout it redirects this call to
     18 // ShelfLayoutManager.
     19 class StatusAreaLayoutManager : public aura::LayoutManager {
     20  public:
     21   explicit StatusAreaLayoutManager(ShelfWidget* shelf);
     22   virtual ~StatusAreaLayoutManager();
     23 
     24   // Overridden from aura::LayoutManager:
     25   virtual void OnWindowResized() OVERRIDE;
     26   virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
     27   virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
     28   virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE;
     29   virtual void OnChildWindowVisibilityChanged(aura::Window* child,
     30                                               bool visible) OVERRIDE;
     31   virtual void SetChildBounds(aura::Window* child,
     32                               const gfx::Rect& requested_bounds) OVERRIDE;
     33 
     34  private:
     35   // Updates layout of the status area. Effectively calls ShelfLayoutManager
     36   // to update layout of the shelf.
     37   void LayoutStatusArea();
     38 
     39   // True when inside LayoutStatusArea method.
     40   // Used to prevent calling itself again from SetChildBounds().
     41   bool in_layout_;
     42 
     43   ShelfWidget* shelf_;
     44 
     45   DISALLOW_COPY_AND_ASSIGN(StatusAreaLayoutManager);
     46 };
     47 
     48 }  // namespace internal
     49 }  // namespace ash
     50 
     51 #endif  // ASH_WM_STATUS_AREA_LAYOUT_MANAGER_H_
     52