| Index: ash/launcher/launcher.cc
|
| diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc
|
| index f97c1903a172fa940b223d70ec0553eb4d251f5d..a4282996ee2e2e1da609a89ef4de8d30840440d6 100644
|
| --- a/ash/launcher/launcher.cc
|
| +++ b/ash/launcher/launcher.cc
|
| @@ -37,9 +37,6 @@ class Launcher::DelegateView : public views::WidgetDelegate,
|
| explicit DelegateView(Launcher* launcher);
|
| virtual ~DelegateView();
|
|
|
| - void SetStatusWidth(int width);
|
| - int status_width() const { return status_width_; }
|
| -
|
| void set_focus_cycler(internal::FocusCycler* focus_cycler) {
|
| focus_cycler_ = focus_cycler;
|
| }
|
| @@ -66,10 +63,6 @@ class Launcher::DelegateView : public views::WidgetDelegate,
|
|
|
| private:
|
| Launcher* launcher_;
|
| -
|
| - // Width of the status area.
|
| - int status_width_;
|
| -
|
| internal::FocusCycler* focus_cycler_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(DelegateView);
|
| @@ -77,21 +70,12 @@ class Launcher::DelegateView : public views::WidgetDelegate,
|
|
|
| Launcher::DelegateView::DelegateView(Launcher* launcher)
|
| : launcher_(launcher),
|
| - status_width_(0),
|
| focus_cycler_(NULL) {
|
| }
|
|
|
| Launcher::DelegateView::~DelegateView() {
|
| }
|
|
|
| -void Launcher::DelegateView::SetStatusWidth(int width) {
|
| - if (status_width_ == width)
|
| - return;
|
| -
|
| - status_width_ = width;
|
| - Layout();
|
| -}
|
| -
|
| gfx::Size Launcher::DelegateView::GetPreferredSize() {
|
| return child_count() > 0 ? child_at(0)->GetPreferredSize() : gfx::Size();
|
| }
|
| @@ -99,7 +83,13 @@ gfx::Size Launcher::DelegateView::GetPreferredSize() {
|
| void Launcher::DelegateView::Layout() {
|
| if (child_count() == 0)
|
| return;
|
| - child_at(0)->SetBounds(0, 0, std::max(0, width() - status_width_), height());
|
| + if (launcher_->alignment_ == SHELF_ALIGNMENT_BOTTOM) {
|
| + int w = std::max(0, width() - launcher_->status_size_.width());
|
| + child_at(0)->SetBounds(0, 0, w, height());
|
| + } else {
|
| + int h = std::max(0, height() - launcher_->status_size_.height());
|
| + child_at(0)->SetBounds(0, 0, width(), h);
|
| + }
|
| }
|
|
|
| // Launcher --------------------------------------------------------------------
|
| @@ -109,6 +99,7 @@ Launcher::Launcher(aura::Window* window_container)
|
| window_container_(window_container),
|
| delegate_view_(NULL),
|
| launcher_view_(NULL),
|
| + alignment_(SHELF_ALIGNMENT_BOTTOM),
|
| ALLOW_THIS_IN_INITIALIZER_LIST(
|
| background_animator_(this, 0, kBackgroundAlpha)) {
|
| model_.reset(new LauncherModel);
|
| @@ -135,7 +126,7 @@ Launcher::Launcher(aura::Window* window_container)
|
| widget_->GetNativeWindow()->SetName("LauncherWindow");
|
| gfx::Size pref =
|
| static_cast<views::View*>(launcher_view_)->GetPreferredSize();
|
| - widget_->SetBounds(gfx::Rect(0, 0, pref.width(), pref.height()));
|
| + widget_->SetBounds(gfx::Rect(pref));
|
| // The launcher should not take focus when it is initially shown.
|
| widget_->set_focus_on_creation(false);
|
| widget_->SetContentsView(delegate_view_);
|
| @@ -155,18 +146,24 @@ internal::FocusCycler* Launcher::GetFocusCycler() {
|
| return delegate_view_->focus_cycler();
|
| }
|
|
|
| +void Launcher::SetAlignment(ShelfAlignment alignment) {
|
| + alignment_ = alignment;
|
| + launcher_view_->SetAlignment(alignment);
|
| + // ShelfLayoutManager will resize the launcher.
|
| +}
|
| +
|
| void Launcher::SetPaintsBackground(
|
| bool value,
|
| internal::BackgroundAnimator::ChangeType change_type) {
|
| background_animator_.SetPaintsBackground(value, change_type);
|
| }
|
|
|
| -void Launcher::SetStatusWidth(int width) {
|
| - delegate_view_->SetStatusWidth(width);
|
| -}
|
| +void Launcher::SetStatusSize(const gfx::Size& size) {
|
| + if (status_size_ == size)
|
| + return;
|
|
|
| -int Launcher::GetStatusWidth() {
|
| - return delegate_view_->status_width();
|
| + status_size_ = size;
|
| + delegate_view_->Layout();
|
| }
|
|
|
| gfx::Rect Launcher::GetScreenBoundsOfItemIconForWindow(aura::Window* window) {
|
|
|