[Aura] Refresh status area widget bounds on StatusAreaView layout.

Make ShelfLayoutController a ShelfLayoutManager for launcher, status windows.

Relanding http://codereview.chromium.org/8743014/
win_aura buildbot just needed a clobber.

BUG=105661
TEST=Manual. Status area is represented with all icons on Aura.
TBR=sky

Review URL: http://codereview.chromium.org/8819016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113201 0039d316-1c4b-4281-b951-d872f2087c98
parent 13911741
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "ui/views/border.h" #include "ui/views/border.h"
#if defined(USE_AURA)
#include "ui/views/widget/widget.h"
#endif
// Number of pixels to separate each icon. // Number of pixels to separate each icon.
#if defined(TOUCH_UI) #if defined(TOUCH_UI)
const int kSeparation = 25; const int kSeparation = 25;
...@@ -92,6 +96,10 @@ void StatusAreaView::ChildPreferredSizeChanged(View* child) { ...@@ -92,6 +96,10 @@ void StatusAreaView::ChildPreferredSizeChanged(View* child) {
// BrowserView know to relayout, which will reset the bounds of this view. // BrowserView know to relayout, which will reset the bounds of this view.
Layout(); Layout();
PreferredSizeChanged(); PreferredSizeChanged();
#if defined(USE_AURA)
if (GetWidget())
GetWidget()->SetSize(GetPreferredSize());
#endif
} }
void StatusAreaView::MakeButtonsActive(bool active) { void StatusAreaView::MakeButtonsActive(bool active) {
......
...@@ -80,8 +80,8 @@ ...@@ -80,8 +80,8 @@
'shadow.h', 'shadow.h',
'shadow_controller.cc', 'shadow_controller.cc',
'shadow_controller.h', 'shadow_controller.h',
'shelf_layout_controller.cc', 'shelf_layout_manager.cc',
'shelf_layout_controller.h', 'shelf_layout_manager.h',
'shell.cc', 'shell.cc',
'shell.h', 'shell.h',
'shell_accelerator_controller.cc', 'shell_accelerator_controller.cc',
...@@ -97,6 +97,8 @@ ...@@ -97,6 +97,8 @@
'show_state_controller.cc', 'show_state_controller.cc',
'stacking_controller.cc', 'stacking_controller.cc',
'stacking_controller.h', 'stacking_controller.h',
'status_area_layout_manager.cc',
'status_area_layout_manager.h',
'status_area_view.cc', 'status_area_view.cc',
'status_area_view.h', 'status_area_view.h',
'toplevel_frame_view.cc', 'toplevel_frame_view.cc',
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "ui/aura_shell/desktop_layout_manager.h" #include "ui/aura_shell/desktop_layout_manager.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura_shell/shelf_layout_controller.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
namespace aura_shell { namespace aura_shell {
...@@ -16,8 +15,7 @@ namespace internal { ...@@ -16,8 +15,7 @@ namespace internal {
DesktopLayoutManager::DesktopLayoutManager(aura::Window* owner) DesktopLayoutManager::DesktopLayoutManager(aura::Window* owner)
: owner_(owner), : owner_(owner),
background_widget_(NULL), background_widget_(NULL) {
shelf_(NULL) {
} }
DesktopLayoutManager::~DesktopLayoutManager() { DesktopLayoutManager::~DesktopLayoutManager() {
...@@ -35,9 +33,6 @@ void DesktopLayoutManager::OnWindowResized() { ...@@ -35,9 +33,6 @@ void DesktopLayoutManager::OnWindowResized() {
(*i)->SetBounds(fullscreen_bounds); (*i)->SetBounds(fullscreen_bounds);
background_widget_->SetBounds(fullscreen_bounds); background_widget_->SetBounds(fullscreen_bounds);
if (shelf_)
shelf_->LayoutShelf();
} }
void DesktopLayoutManager::OnWindowAddedToLayout(aura::Window* child) { void DesktopLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
...@@ -55,6 +50,5 @@ void DesktopLayoutManager::SetChildBounds(aura::Window* child, ...@@ -55,6 +50,5 @@ void DesktopLayoutManager::SetChildBounds(aura::Window* child,
SetChildBoundsDirect(child, requested_bounds); SetChildBoundsDirect(child, requested_bounds);
} }
} // namespace internal } // namespace internal
} // namespace aura_shell } // namespace aura_shell
...@@ -23,8 +23,6 @@ class Widget; ...@@ -23,8 +23,6 @@ class Widget;
namespace aura_shell { namespace aura_shell {
namespace internal { namespace internal {
class ShelfLayoutController;
// A layout manager for the root window. // A layout manager for the root window.
// Resizes all of its immediate children to fill the bounds of the root window. // Resizes all of its immediate children to fill the bounds of the root window.
class DesktopLayoutManager : public aura::LayoutManager { class DesktopLayoutManager : public aura::LayoutManager {
...@@ -32,8 +30,6 @@ class DesktopLayoutManager : public aura::LayoutManager { ...@@ -32,8 +30,6 @@ class DesktopLayoutManager : public aura::LayoutManager {
explicit DesktopLayoutManager(aura::Window* owner); explicit DesktopLayoutManager(aura::Window* owner);
virtual ~DesktopLayoutManager(); virtual ~DesktopLayoutManager();
void set_shelf(ShelfLayoutController* shelf) { shelf_ = shelf; }
void set_background_widget(views::Widget* background_widget) { void set_background_widget(views::Widget* background_widget) {
background_widget_ = background_widget; background_widget_ = background_widget;
} }
...@@ -52,8 +48,6 @@ class DesktopLayoutManager : public aura::LayoutManager { ...@@ -52,8 +48,6 @@ class DesktopLayoutManager : public aura::LayoutManager {
views::Widget* background_widget_; views::Widget* background_widget_;
ShelfLayoutController* shelf_;
DISALLOW_COPY_AND_ASSIGN(DesktopLayoutManager); DISALLOW_COPY_AND_ASSIGN(DesktopLayoutManager);
}; };
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "ui/aura_shell/shelf_layout_controller.h" #include "ui/aura_shell/shelf_layout_manager.h"
#include "base/auto_reset.h"
#include "ui/aura/desktop.h" #include "ui/aura/desktop.h"
#include "ui/aura/screen_aura.h" #include "ui/aura/screen_aura.h"
#include "ui/gfx/compositor/layer.h" #include "ui/gfx/compositor/layer.h"
...@@ -21,9 +22,13 @@ ui::Layer* GetLayer(views::Widget* widget) { ...@@ -21,9 +22,13 @@ ui::Layer* GetLayer(views::Widget* widget) {
} // namespace } // namespace
ShelfLayoutController::ShelfLayoutController(views::Widget* launcher, ////////////////////////////////////////////////////////////////////////////////
views::Widget* status) // ShelfLayoutManager, public:
ShelfLayoutManager::ShelfLayoutManager(views::Widget* launcher,
views::Widget* status)
: animating_(false), : animating_(false),
in_layout_(false),
visible_(true), visible_(true),
max_height_(-1), max_height_(-1),
launcher_(launcher), launcher_(launcher),
...@@ -34,12 +39,14 @@ ShelfLayoutController::ShelfLayoutController(views::Widget* launcher, ...@@ -34,12 +39,14 @@ ShelfLayoutController::ShelfLayoutController(views::Widget* launcher,
GetLayer(launcher)->GetAnimator()->AddObserver(this); GetLayer(launcher)->GetAnimator()->AddObserver(this);
} }
ShelfLayoutController::~ShelfLayoutController() {
ShelfLayoutManager::~ShelfLayoutManager() {
// Do not try to remove observer from layer as the Launcher is // Do not try to remove observer from layer as the Launcher is
// already deleted. // already deleted.
} }
void ShelfLayoutController::LayoutShelf() { void ShelfLayoutManager::LayoutShelf() {
AutoReset<bool> auto_reset_in_layout(&in_layout_, true);
StopAnimating(); StopAnimating();
TargetBounds target_bounds; TargetBounds target_bounds;
float target_opacity = visible_ ? 1.0f : 0.0f; float target_opacity = visible_ ? 1.0f : 0.0f;
...@@ -52,7 +59,7 @@ void ShelfLayoutController::LayoutShelf() { ...@@ -52,7 +59,7 @@ void ShelfLayoutController::LayoutShelf() {
target_bounds.work_area_insets); target_bounds.work_area_insets);
} }
void ShelfLayoutController::SetVisible(bool visible) { void ShelfLayoutManager::SetVisible(bool visible) {
bool current_visibility = animating_ ? !visible_ : visible_; bool current_visibility = animating_ ? !visible_ : visible_;
if (visible == current_visibility) if (visible == current_visibility)
return; // Nothing changed. return; // Nothing changed.
...@@ -68,7 +75,34 @@ void ShelfLayoutController::SetVisible(bool visible) { ...@@ -68,7 +75,34 @@ void ShelfLayoutController::SetVisible(bool visible) {
// |visible_| is updated once the animation completes. // |visible_| is updated once the animation completes.
} }
void ShelfLayoutController::StopAnimating() { ////////////////////////////////////////////////////////////////////////////////
// ShelfLayoutManager, aura::LayoutManager implementation:
void ShelfLayoutManager::OnWindowResized() {
LayoutShelf();
}
void ShelfLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
}
void ShelfLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) {
}
void ShelfLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child,
bool visible) {
}
void ShelfLayoutManager::SetChildBounds(aura::Window* child,
const gfx::Rect& requested_bounds) {
SetChildBoundsDirect(child, requested_bounds);
if (!in_layout_)
LayoutShelf();
}
////////////////////////////////////////////////////////////////////////////////
// ShelfLayoutManager, private:
void ShelfLayoutManager::StopAnimating() {
if (animating_) { if (animating_) {
animating_ = false; animating_ = false;
visible_ = !visible_; visible_ = !visible_;
...@@ -76,8 +110,8 @@ void ShelfLayoutController::StopAnimating() { ...@@ -76,8 +110,8 @@ void ShelfLayoutController::StopAnimating() {
GetLayer(launcher_)->GetAnimator()->StopAnimating(); GetLayer(launcher_)->GetAnimator()->StopAnimating();
} }
void ShelfLayoutController::CalculateTargetBounds(bool visible, void ShelfLayoutManager::CalculateTargetBounds(bool visible,
TargetBounds* target_bounds) { TargetBounds* target_bounds) {
const gfx::Rect& available_bounds(aura::Desktop::GetInstance()->bounds()); const gfx::Rect& available_bounds(aura::Desktop::GetInstance()->bounds());
int y = available_bounds.bottom() - (visible ? max_height_ : 0); int y = available_bounds.bottom() - (visible ? max_height_ : 0);
gfx::Rect status_bounds(status_->GetWindowScreenBounds()); gfx::Rect status_bounds(status_->GetWindowScreenBounds());
...@@ -94,16 +128,16 @@ void ShelfLayoutController::CalculateTargetBounds(bool visible, ...@@ -94,16 +128,16 @@ void ShelfLayoutController::CalculateTargetBounds(bool visible,
target_bounds->work_area_insets = gfx::Insets(0, 0, max_height_, 0); target_bounds->work_area_insets = gfx::Insets(0, 0, max_height_, 0);
} }
void ShelfLayoutController::AnimateWidgetTo(views::Widget* widget, void ShelfLayoutManager::AnimateWidgetTo(views::Widget* widget,
const gfx::Rect& target_bounds, const gfx::Rect& target_bounds,
float target_opacity) { float target_opacity) {
ui::Layer* layer = GetLayer(widget); ui::Layer* layer = GetLayer(widget);
ui::LayerAnimator::ScopedSettings animation_setter(layer->GetAnimator()); ui::LayerAnimator::ScopedSettings animation_setter(layer->GetAnimator());
widget->SetBounds(target_bounds); widget->SetBounds(target_bounds);
layer->SetOpacity(target_opacity); layer->SetOpacity(target_opacity);
} }
void ShelfLayoutController::OnLayerAnimationEnded( void ShelfLayoutManager::OnLayerAnimationEnded(
const ui::LayerAnimationSequence* sequence) { const ui::LayerAnimationSequence* sequence) {
if (!animating_) if (!animating_)
return; return;
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_ #ifndef UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_
#define UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_ #define UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_
#pragma once #pragma once
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "ui/aura/layout_manager.h"
#include "ui/gfx/compositor/layer_animation_observer.h" #include "ui/gfx/compositor/layer_animation_observer.h"
#include "ui/gfx/insets.h" #include "ui/gfx/insets.h"
#include "ui/gfx/rect.h" #include "ui/gfx/rect.h"
...@@ -19,13 +20,17 @@ class Widget; ...@@ -19,13 +20,17 @@ class Widget;
namespace aura_shell { namespace aura_shell {
namespace internal { namespace internal {
// ShelfLayoutController is responsible for showing and hiding the launcher and // ShelfLayoutManager is a layout manager responsible for the launcher.
// status area as well as positioning them. // Also supports showing and hiding the launcher/status area
class ShelfLayoutController : public ui::LayerAnimationObserver { // as well as positioning them.
class ShelfLayoutManager : public aura::LayoutManager,
public ui::LayerAnimationObserver {
public: public:
ShelfLayoutController(views::Widget* launcher, ShelfLayoutManager(views::Widget* launcher,
views::Widget* status); views::Widget* status);
virtual ~ShelfLayoutController(); virtual ~ShelfLayoutManager();
bool in_layout() const { return in_layout_; }
// Stops any animations and sets the bounds of the launcher and status // Stops any animations and sets the bounds of the launcher and status
// widgets. // widgets.
...@@ -34,6 +39,15 @@ class ShelfLayoutController : public ui::LayerAnimationObserver { ...@@ -34,6 +39,15 @@ class ShelfLayoutController : public ui::LayerAnimationObserver {
// Sets the visbility of the shelf to |visible|. // Sets the visbility of the shelf to |visible|.
void SetVisible(bool 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: private:
struct TargetBounds { struct TargetBounds {
gfx::Rect launcher_bounds; gfx::Rect launcher_bounds;
...@@ -64,6 +78,10 @@ class ShelfLayoutController : public ui::LayerAnimationObserver { ...@@ -64,6 +78,10 @@ class ShelfLayoutController : public ui::LayerAnimationObserver {
// Are we animating? // Are we animating?
bool 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 // Current visibility. When the visibility changes this field is reset once
// the animation completes. // the animation completes.
bool visible_; bool visible_;
...@@ -74,10 +92,10 @@ class ShelfLayoutController : public ui::LayerAnimationObserver { ...@@ -74,10 +92,10 @@ class ShelfLayoutController : public ui::LayerAnimationObserver {
views::Widget* launcher_; views::Widget* launcher_;
views::Widget* status_; views::Widget* status_;
DISALLOW_COPY_AND_ASSIGN(ShelfLayoutController); DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManager);
}; };
} // namespace internal } // namespace internal
} // namespace aura_shell } // namespace aura_shell
#endif // UI_AURA_SHELL_SHELF_LAYOUT_CONTROLLER_H_ #endif // UI_AURA_SHELL_SHELF_LAYOUT_MANAGER_H_
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/drag_drop_client.h" #include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/desktop.h" #include "ui/aura/desktop.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura/window_types.h" #include "ui/aura/window_types.h"
#include "ui/aura_shell/app_list.h" #include "ui/aura_shell/app_list.h"
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
#include "ui/aura_shell/launcher/launcher.h" #include "ui/aura_shell/launcher/launcher.h"
#include "ui/aura_shell/modal_container_layout_manager.h" #include "ui/aura_shell/modal_container_layout_manager.h"
#include "ui/aura_shell/shadow_controller.h" #include "ui/aura_shell/shadow_controller.h"
#include "ui/aura_shell/shelf_layout_controller.h" #include "ui/aura_shell/shelf_layout_manager.h"
#include "ui/aura_shell/shell_accelerator_controller.h" #include "ui/aura_shell/shell_accelerator_controller.h"
#include "ui/aura_shell/shell_accelerator_filter.h" #include "ui/aura_shell/shell_accelerator_filter.h"
#include "ui/aura_shell/shell_delegate.h" #include "ui/aura_shell/shell_delegate.h"
...@@ -29,6 +30,7 @@ ...@@ -29,6 +30,7 @@
#include "ui/aura_shell/shell_tooltip_manager.h" #include "ui/aura_shell/shell_tooltip_manager.h"
#include "ui/aura_shell/shell_window_ids.h" #include "ui/aura_shell/shell_window_ids.h"
#include "ui/aura_shell/stacking_controller.h" #include "ui/aura_shell/stacking_controller.h"
#include "ui/aura_shell/status_area_layout_manager.h"
#include "ui/aura_shell/toplevel_layout_manager.h" #include "ui/aura_shell/toplevel_layout_manager.h"
#include "ui/aura_shell/toplevel_window_event_filter.h" #include "ui/aura_shell/toplevel_window_event_filter.h"
#include "ui/aura_shell/workspace_controller.h" #include "ui/aura_shell/workspace_controller.h"
...@@ -204,9 +206,15 @@ void Shell::Init() { ...@@ -204,9 +206,15 @@ void Shell::Init() {
if (!status_widget) if (!status_widget)
status_widget = internal::CreateStatusArea(); status_widget = internal::CreateStatusArea();
shelf_layout_controller_.reset(new internal::ShelfLayoutController( internal::ShelfLayoutManager* shelf_layout_manager =
launcher_->widget(), status_widget)); new internal::ShelfLayoutManager(launcher_->widget(), status_widget);
desktop_layout->set_shelf(shelf_layout_controller_.get()); GetContainer(aura_shell::internal::kShellWindowId_LauncherContainer)->
SetLayoutManager(shelf_layout_manager);
internal::StatusAreaLayoutManager* status_area_layout_manager =
new internal::StatusAreaLayoutManager(shelf_layout_manager);
GetContainer(aura_shell::internal::kShellWindowId_StatusContainer)->
SetLayoutManager(status_area_layout_manager);
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraNoShadows)) if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kAuraNoShadows))
shadow_controller_.reset(new internal::ShadowController()); shadow_controller_.reset(new internal::ShadowController());
...@@ -217,7 +225,7 @@ void Shell::Init() { ...@@ -217,7 +225,7 @@ void Shell::Init() {
internal::ToplevelLayoutManager* toplevel_layout_manager = internal::ToplevelLayoutManager* toplevel_layout_manager =
new internal::ToplevelLayoutManager(); new internal::ToplevelLayoutManager();
default_container->SetLayoutManager(toplevel_layout_manager); default_container->SetLayoutManager(toplevel_layout_manager);
toplevel_layout_manager->set_shelf(shelf_layout_controller_.get()); toplevel_layout_manager->set_shelf(shelf_layout_manager);
} }
// Force a layout. // Force a layout.
......
...@@ -35,7 +35,6 @@ namespace internal { ...@@ -35,7 +35,6 @@ namespace internal {
class AppList; class AppList;
class DragDropController; class DragDropController;
class ShadowController; class ShadowController;
class ShelfLayoutController;
class ShellAcceleratorFilter; class ShellAcceleratorFilter;
class WorkspaceController; class WorkspaceController;
} }
...@@ -112,7 +111,6 @@ class AURA_SHELL_EXPORT Shell { ...@@ -112,7 +111,6 @@ class AURA_SHELL_EXPORT Shell {
scoped_ptr<internal::DragDropController> drag_drop_controller_; scoped_ptr<internal::DragDropController> drag_drop_controller_;
scoped_ptr<internal::WorkspaceController> workspace_controller_; scoped_ptr<internal::WorkspaceController> workspace_controller_;
scoped_ptr<internal::ShelfLayoutController> shelf_layout_controller_;
scoped_ptr<internal::ShadowController> shadow_controller_; scoped_ptr<internal::ShadowController> shadow_controller_;
// An event filter that pre-handles global accelerators. // An event filter that pre-handles global accelerators.
......
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/aura_shell/status_area_layout_manager.h"
#include "base/auto_reset.h"
#include "ui/aura_shell/shelf_layout_manager.h"
namespace aura_shell {
namespace internal {
////////////////////////////////////////////////////////////////////////////////
// StatusAreaLayoutManager, public:
StatusAreaLayoutManager::StatusAreaLayoutManager(ShelfLayoutManager* shelf)
: in_layout_(false),
shelf_(shelf) {
}
StatusAreaLayoutManager::~StatusAreaLayoutManager() {
}
////////////////////////////////////////////////////////////////////////////////
// StatusAreaLayoutManager, aura::LayoutManager implementation:
void StatusAreaLayoutManager::OnWindowResized() {
LayoutStatusArea();
}
void StatusAreaLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
}
void StatusAreaLayoutManager::OnWillRemoveWindowFromLayout(
aura::Window* child) {
}
void StatusAreaLayoutManager::OnChildWindowVisibilityChanged(
aura::Window* child, bool visible) {
}
void StatusAreaLayoutManager::SetChildBounds(
aura::Window* child, const gfx::Rect& requested_bounds) {
SetChildBoundsDirect(child, requested_bounds);
if (!in_layout_)
LayoutStatusArea();
}
////////////////////////////////////////////////////////////////////////////////
// StatusAreaLayoutManager, private:
void StatusAreaLayoutManager::LayoutStatusArea() {
// Shelf layout manager may be already doing layout.
if (shelf_->in_layout())
return;
AutoReset<bool> auto_reset_in_layout(&in_layout_, true);
shelf_->LayoutShelf();
}
} // internal
} // aura_shell
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_AURA_SHELL_STATUS_AREA_LAYOUT_MANAGER_H_
#define UI_AURA_SHELL_STATUS_AREA_LAYOUT_MANAGER_H_
#pragma once
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ui/aura/layout_manager.h"
namespace aura_shell {
namespace internal {
class ShelfLayoutManager;
// StatusAreaLayoutManager is a layout manager responsible for the status area.
// In any case when status area needs relayout it redirects this call to
// ShelfLayoutManager.
class StatusAreaLayoutManager : public aura::LayoutManager {
public:
explicit StatusAreaLayoutManager(ShelfLayoutManager* shelf);
virtual ~StatusAreaLayoutManager();
// 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:
// Updates layout of the status area. Effectively calls ShelfLayoutManager
// to update layout of the shelf.
void LayoutStatusArea();
// True when inside LayoutStatusArea method.
// Used to prevent calling itself again from SetChildBounds().
bool in_layout_;
ShelfLayoutManager* shelf_;
DISALLOW_COPY_AND_ASSIGN(StatusAreaLayoutManager);
};
} // namespace internal
} // namespace aura_shell
#endif // UI_AURA_SHELL_STATUS_AREA_LAYOUT_MANAGER_H_
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/aura_shell/property_util.h" #include "ui/aura_shell/property_util.h"
#include "ui/aura_shell/shelf_layout_controller.h" #include "ui/aura_shell/shelf_layout_manager.h"
#include "ui/aura_shell/workspace/workspace.h" #include "ui/aura_shell/workspace/workspace.h"
#include "ui/aura_shell/workspace/workspace_manager.h" #include "ui/aura_shell/workspace/workspace_manager.h"
#include "ui/base/ui_base_types.h" #include "ui/base/ui_base_types.h"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
namespace aura_shell { namespace aura_shell {
namespace internal { namespace internal {
class ShelfLayoutController; class ShelfLayoutManager;
// ToplevelLayoutManager is the LayoutManager installed on a container that // ToplevelLayoutManager is the LayoutManager installed on a container that
// hosts what the shell considers to be top-level windows. It is used if the // hosts what the shell considers to be top-level windows. It is used if the
...@@ -29,7 +29,7 @@ class AURA_SHELL_EXPORT ToplevelLayoutManager : public aura::LayoutManager, ...@@ -29,7 +29,7 @@ class AURA_SHELL_EXPORT ToplevelLayoutManager : public aura::LayoutManager,
ToplevelLayoutManager(); ToplevelLayoutManager();
virtual ~ToplevelLayoutManager(); virtual ~ToplevelLayoutManager();
void set_shelf(ShelfLayoutController* shelf) { shelf_ = shelf; } void set_shelf(ShelfLayoutManager* shelf) { shelf_ = shelf; }
// LayoutManager overrides: // LayoutManager overrides:
virtual void OnWindowResized() OVERRIDE; virtual void OnWindowResized() OVERRIDE;
...@@ -58,7 +58,7 @@ class AURA_SHELL_EXPORT ToplevelLayoutManager : public aura::LayoutManager, ...@@ -58,7 +58,7 @@ class AURA_SHELL_EXPORT ToplevelLayoutManager : public aura::LayoutManager,
// Set of windows we're listening to. // Set of windows we're listening to.
Windows windows_; Windows windows_;
ShelfLayoutController* shelf_; ShelfLayoutManager* shelf_;
DISALLOW_COPY_AND_ASSIGN(ToplevelLayoutManager); DISALLOW_COPY_AND_ASSIGN(ToplevelLayoutManager);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment