diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-20 16:24:10 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-20 16:24:10 +0000 |
commit | 3acf5a57a0f4a68c45838e21bf928ee6760f8390 (patch) | |
tree | 595d897349bbc82cc25a3ddcd5c3d4126c315503 /ui | |
parent | 360ded8150e6868e6906e9c19dfcbf9823d2c115 (diff) | |
download | chromium_src-3acf5a57a0f4a68c45838e21bf928ee6760f8390.zip chromium_src-3acf5a57a0f4a68c45838e21bf928ee6760f8390.tar.gz chromium_src-3acf5a57a0f4a68c45838e21bf928ee6760f8390.tar.bz2 |
LayoutManager controls child bounds. Added SetChildBounds and several listener methods to LayoutManager class. They will be used to implement more sophisticated behavior.
Implemented DefaultContainerLayoutManager.
Added test_support_aura component so that it can be shared
between aura and aura_shell.
Fixed component build for aura_shell_unittests
BUG=none
TEST=default_container_layout_manager_unittests.
Review URL: http://codereview.chromium.org/8296002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106508 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/aura.gyp | 37 | ||||
-rw-r--r-- | ui/aura/layout_manager.cc | 22 | ||||
-rw-r--r-- | ui/aura/layout_manager.h | 32 | ||||
-rw-r--r-- | ui/aura/test/aura_test_base.h | 3 | ||||
-rw-r--r-- | ui/aura/test/event_generator.h | 3 | ||||
-rw-r--r-- | ui/aura/test/test_desktop_delegate.h | 3 | ||||
-rw-r--r-- | ui/aura/window.cc | 14 | ||||
-rw-r--r-- | ui/aura/window.h | 6 | ||||
-rw-r--r-- | ui/aura_shell/aura_shell.gyp | 6 | ||||
-rw-r--r-- | ui/aura_shell/default_container_layout_manager.cc | 67 | ||||
-rw-r--r-- | ui/aura_shell/default_container_layout_manager.h | 48 | ||||
-rw-r--r-- | ui/aura_shell/default_container_layout_manager_unittest.cc | 83 | ||||
-rw-r--r-- | ui/aura_shell/desktop_layout_manager.cc | 15 | ||||
-rw-r--r-- | ui/aura_shell/desktop_layout_manager.h | 9 | ||||
-rw-r--r-- | ui/aura_shell/shell.cc | 9 |
15 files changed, 337 insertions, 20 deletions
diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp index 828227b..e246511 100644 --- a/ui/aura/aura.gyp +++ b/ui/aura/aura.gyp @@ -37,6 +37,7 @@ 'event_filter.h', 'focus_manager.h', 'hit_test.h', + 'layout_manager.cc', 'layout_manager.h', 'screen_aura.cc', 'screen_aura.h', @@ -52,6 +53,31 @@ ], }, { + 'target_name': 'test_support_aura', + 'type': 'static_library', + 'dependencies': [ + '../../skia/skia.gyp:skia', + '../../testing/gtest.gyp:gtest', + '../ui.gyp:ui', + 'aura', + ], + 'include_dirs': [ + '..', + ], + 'sources': [ + 'test/aura_test_base.cc', + 'test/aura_test_base.h', + 'test/event_generator.cc', + 'test/event_generator.h', + 'test/test_desktop_delegate.cc', + 'test/test_desktop_delegate.h', + '../gfx/compositor/test_compositor.cc', + '../gfx/compositor/test_compositor.h', + '../gfx/compositor/test_texture.cc', + '../gfx/compositor/test_texture.h', + ], + }, + { 'target_name': 'aura_demo', 'type': 'executable', 'dependencies': [ @@ -87,29 +113,20 @@ '../ui.gyp:gfx_resources', '../ui.gyp:ui', '../ui.gyp:ui_resources', + 'test_support_aura', 'aura', ], 'include_dirs': [ '..', ], 'sources': [ - 'test/aura_test_base.cc', - 'test/aura_test_base.h', - 'test/event_generator.cc', - 'test/event_generator.h', 'test/run_all_unittests.cc', - 'test/test_desktop_delegate.cc', - 'test/test_desktop_delegate.h', 'test/test_suite.cc', 'test/test_suite.h', 'test/test_window_delegate.cc', 'test/test_window_delegate.h', 'toplevel_window_event_filter_unittest.cc', 'window_unittest.cc', - '../gfx/compositor/test_compositor.cc', - '../gfx/compositor/test_compositor.h', - '../gfx/compositor/test_texture.cc', - '../gfx/compositor/test_texture.h', '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/ui_resources.rc', ], diff --git a/ui/aura/layout_manager.cc b/ui/aura/layout_manager.cc new file mode 100644 index 0000000..4780ae0 --- /dev/null +++ b/ui/aura/layout_manager.cc @@ -0,0 +1,22 @@ +// 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/layout_manager.h" + +#include "ui/aura/window.h" + +namespace aura { + +LayoutManager::LayoutManager() { +} + +LayoutManager::~LayoutManager() { +} + +void LayoutManager::SetChildBounds(aura::Window* child, + const gfx::Rect& bounds) { + child->SetBoundsInternal(bounds); +} + +} // namespace aura diff --git a/ui/aura/layout_manager.h b/ui/aura/layout_manager.h index be4e856..5ff905b 100644 --- a/ui/aura/layout_manager.h +++ b/ui/aura/layout_manager.h @@ -6,17 +6,45 @@ #define UI_AURA_LAYOUT_MANAGER_H_ #pragma once +#include "base/basictypes.h" #include "ui/aura/aura_export.h" +namespace gfx { +class Rect; +} + namespace aura { +class Window; // An interface implemented by an object that places child windows. class AURA_EXPORT LayoutManager { public: - virtual ~LayoutManager() {} + LayoutManager(); + virtual ~LayoutManager(); - // Called when the window is resized. + // Invoked when the window is resized. virtual void OnWindowResized() = 0; + + // Invoked when the window |child| has been added. + virtual void OnWindowAdded(Window* child) = 0; + + // Invoked prior to removing |window|. + virtual void OnWillRemoveWindow(Window* child) = 0; + + // Invoked when the |SetVisible()| is invoked on the window |child|. + // |visible| is the value supplied to |SetVisible()|. If |visible| is true, + // window->IsVisible() may still return false. See description in + // Window::IsVisible() for details. + virtual void OnChildWindowVisibilityChanged(Window* child, bool visibile) = 0; + + // Calculates the bounds for the |child| based on |requsted_bounds|. + virtual void CalculateBoundsForChild(Window* child, + gfx::Rect* requested_bounds) = 0; + protected: + // Sets the child's bounds forcibly. LayoutManager is responsible + // for checking the state and make sure the bounds are correctly + // adjusted. + void SetChildBounds(aura::Window* child, const gfx::Rect& bounds); }; } // namespace aura diff --git a/ui/aura/test/aura_test_base.h b/ui/aura/test/aura_test_base.h index 4aafa0f..1d2551a 100644 --- a/ui/aura/test/aura_test_base.h +++ b/ui/aura/test/aura_test_base.h @@ -6,6 +6,7 @@ #define UI_AURA_TEST_AURA_TEST_BASE_H_ #pragma once +#include "ui/aura/aura_export.h" #include "base/compiler_specific.h" #include "base/basictypes.h" #include "base/message_loop.h" @@ -15,7 +16,7 @@ namespace aura { namespace test { // A base class for aura unit tests. -class AuraTestBase : public testing::Test { +class AURA_EXPORT AuraTestBase : public testing::Test { public: AuraTestBase(); virtual ~AuraTestBase(); diff --git a/ui/aura/test/event_generator.h b/ui/aura/test/event_generator.h index afafd4e..2f1b222 100644 --- a/ui/aura/test/event_generator.h +++ b/ui/aura/test/event_generator.h @@ -6,6 +6,7 @@ #define UI_AURA_TEST_EVENT_GENERATOR_H_ #pragma once +#include "ui/aura/aura_export.h" #include "base/basictypes.h" #include "ui/gfx/point.h" @@ -17,7 +18,7 @@ namespace test { // EventGenerator is a tool that generates and dispatch events. // TODO(oshima): Support key events. -class EventGenerator { +class AURA_EXPORT EventGenerator { public: // Creates an EventGenerator with the mouse location (0,0). EventGenerator(); diff --git a/ui/aura/test/test_desktop_delegate.h b/ui/aura/test/test_desktop_delegate.h index 09bfc31e..2be7fe9 100644 --- a/ui/aura/test/test_desktop_delegate.h +++ b/ui/aura/test/test_desktop_delegate.h @@ -6,6 +6,7 @@ #define UI_AURA_TEST_TEST_DESKTOP_DELEGATE_H_ #pragma once +#include "ui/aura/aura_export.h" #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" @@ -17,7 +18,7 @@ class ToplevelWindowContainer; namespace test { -class TestDesktopDelegate : public DesktopDelegate { +class AURA_EXPORT TestDesktopDelegate : public DesktopDelegate { public: // Callers should allocate a TestDesktopDelegate on the heap and then forget // about it -- the c'tor passes ownership of the TestDesktopDelegate to the diff --git a/ui/aura/window.cc b/ui/aura/window.cc index e3945e1..478c318c 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -136,12 +136,16 @@ void Window::SetLayoutManager(LayoutManager* layout_manager) { } void Window::SetBounds(const gfx::Rect& new_bounds) { + gfx::Rect adjusted_bounds = new_bounds; + if (parent_ && parent_->layout_manager()) + parent_->layout_manager()->CalculateBoundsForChild(this, &adjusted_bounds); + if (show_state_ == ui::SHOW_STATE_MAXIMIZED || show_state_ == ui::SHOW_STATE_FULLSCREEN) { - restore_bounds_ = new_bounds; + restore_bounds_ = adjusted_bounds; return; } - SetBoundsInternal(new_bounds); + SetBoundsInternal(adjusted_bounds); } gfx::Rect Window::GetTargetBounds() const { @@ -198,12 +202,16 @@ void Window::AddChild(Window* child) { child->parent_ = this; layer_->Add(child->layer_.get()); children_.push_back(child); + if (layout_manager_.get()) + layout_manager_->OnWindowAdded(child); FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowAdded(child)); } void Window::RemoveChild(Window* child) { Windows::iterator i = std::find(children_.begin(), children_.end(), child); DCHECK(i != children_.end()); + if (layout_manager_.get()) + layout_manager_->OnWillRemoveWindow(child); FOR_EACH_OBSERVER(WindowObserver, observers_, OnWillRemoveWindow(child)); child->parent_ = NULL; layer_->Remove(child->layer_.get()); @@ -422,6 +430,8 @@ void Window::SetVisible(bool visible) { if (delegate_) delegate_->OnWindowVisibilityChanged(is_visible); } + if (parent_ && parent_->layout_manager_.get()) + parent_->layout_manager_->OnChildWindowVisibilityChanged(this, visible); FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowVisibilityChanged(this, visible)); } diff --git a/ui/aura/window.h b/ui/aura/window.h index a2b9617..d510975 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -118,8 +118,10 @@ class AURA_EXPORT Window : public ui::LayerDelegate { // Assigns a LayoutManager to size and place child windows. // The Window takes ownership of the LayoutManager. void SetLayoutManager(LayoutManager* layout_manager); + LayoutManager* layout_manager() { return layout_manager_.get(); } - // Changes the bounds of the window. + // Changes the bounds of the window. If present, the window's parent's + // LayoutManager may adjust the bounds. void SetBounds(const gfx::Rect& new_bounds); // Returns the target bounds of the window. If the window's layer is @@ -253,6 +255,8 @@ class AURA_EXPORT Window : public ui::LayerDelegate { virtual Desktop* GetDesktop(); private: + friend class LayoutManager; + // Changes the bounds of the window without condition. void SetBoundsInternal(const gfx::Rect& new_bounds); diff --git a/ui/aura_shell/aura_shell.gyp b/ui/aura_shell/aura_shell.gyp index 637534b..429ae06 100644 --- a/ui/aura_shell/aura_shell.gyp +++ b/ui/aura_shell/aura_shell.gyp @@ -33,6 +33,8 @@ ], 'sources': [ # All .cc, .h under views, except unittests + 'default_container_layout_manager.cc', + 'default_container_layout_manager.h', 'desktop_background_view.cc', 'desktop_background_view.h', 'desktop_layout_manager.cc', @@ -73,13 +75,17 @@ '../../third_party/icu/icu.gyp:icuuc', '../../views/views.gyp:views', '../gfx/compositor/compositor.gyp:compositor', + '../gfx/gl/gl.gyp:gl', '../ui.gyp:gfx_resources', '../ui.gyp:ui', '../ui.gyp:ui_resources', '../ui.gyp:ui_resources_standard', + '../aura/aura.gyp:aura', + '../aura/aura.gyp:test_support_aura', 'aura_shell', ], 'sources': [ + 'default_container_layout_manager_unittest.cc', 'launcher/launcher_model_unittest.cc', 'launcher/view_model_unittest.cc', 'run_all_unittests.cc', diff --git a/ui/aura_shell/default_container_layout_manager.cc b/ui/aura_shell/default_container_layout_manager.cc new file mode 100644 index 0000000..d3c23c3 --- /dev/null +++ b/ui/aura_shell/default_container_layout_manager.cc @@ -0,0 +1,67 @@ +// 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/default_container_layout_manager.h" + +#include "ui/aura/desktop.h" +#include "ui/aura/window.h" +#include "ui/aura/screen_aura.h" +#include "ui/aura/window_types.h" +#include "ui/gfx/rect.h" + +namespace aura_shell { +namespace internal { + +//////////////////////////////////////////////////////////////////////////////// +// DefaultContainerLayoutManager, public: + +DefaultContainerLayoutManager::DefaultContainerLayoutManager( + aura::Window* owner) + : owner_(owner) { +} + +DefaultContainerLayoutManager::~DefaultContainerLayoutManager() {} + +//////////////////////////////////////////////////////////////////////////////// +// DefaultContainerLayoutManager, aura::LayoutManager implementation: + +void DefaultContainerLayoutManager::OnWindowResized() { + aura::Window::Windows::const_iterator i = owner_->children().begin(); + // Use SetBounds because window may be maximized or fullscreen. + for (; i != owner_->children().end(); ++i) + (*i)->SetBounds((*i)->bounds()); + NOTIMPLEMENTED(); +} + +void DefaultContainerLayoutManager::OnWindowAdded(aura::Window* child) { + child->SetBounds(child->bounds()); + NOTIMPLEMENTED(); +} + +void DefaultContainerLayoutManager::OnWillRemoveWindow(aura::Window* child) { + NOTIMPLEMENTED(); +} + +void DefaultContainerLayoutManager::OnChildWindowVisibilityChanged( + aura::Window* window, bool visibile) { + NOTIMPLEMENTED(); +} + +void DefaultContainerLayoutManager::CalculateBoundsForChild( + aura::Window* child, gfx::Rect* requested_bounds) { + if (child->type() != aura::kWindowType_Toplevel) + return; + // TODO(oshima): Figure out bounds for default windows. + gfx::Rect viewport_bounds = owner_->bounds(); + + // A window can still be placed outside of the screen. + requested_bounds->SetRect( + requested_bounds->x(), + viewport_bounds.y(), + std::min(requested_bounds->width(), viewport_bounds.width()), + std::min(requested_bounds->height(), viewport_bounds.height())); +} + +} // namespace internal +} // namespace aura_shell diff --git a/ui/aura_shell/default_container_layout_manager.h b/ui/aura_shell/default_container_layout_manager.h new file mode 100644 index 0000000..3ea8946 --- /dev/null +++ b/ui/aura_shell/default_container_layout_manager.h @@ -0,0 +1,48 @@ +// 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_DEFAULT_CONTAINER_LAYOUT_MANAGER_H_ +#define UI_AURA_SHELL_DEFAULT_CONTAINER_LAYOUT_MANAGER_H_ +#pragma once + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "ui/aura/layout_manager.h" + +namespace aura { +class Window; +} + +namespace gfx { +class Rect; +} + +namespace aura_shell { +namespace internal { + +// LayoutManager for the default window container. +class DefaultContainerLayoutManager : public aura::LayoutManager { + public: + explicit DefaultContainerLayoutManager(aura::Window* owner); + virtual ~DefaultContainerLayoutManager(); + + // Overridden from aura::LayoutManager: + virtual void OnWindowResized() OVERRIDE; + virtual void OnWindowAdded(aura::Window* child) OVERRIDE; + virtual void OnWillRemoveWindow(aura::Window* child) OVERRIDE; + virtual void OnChildWindowVisibilityChanged(aura::Window* child, + bool visibile) OVERRIDE; + virtual void CalculateBoundsForChild(aura::Window* child, + gfx::Rect* requested_bounds) OVERRIDE; + + private: + aura::Window* owner_; + + DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManager); +}; + +} // namespace internal +} // namespace aura_shell + +#endif // UI_AURA_SHELL_DEFAULT_CONTAINER_LAYOUT_MANAGER_H_ diff --git a/ui/aura_shell/default_container_layout_manager_unittest.cc b/ui/aura_shell/default_container_layout_manager_unittest.cc new file mode 100644 index 0000000..9eef80e --- /dev/null +++ b/ui/aura_shell/default_container_layout_manager_unittest.cc @@ -0,0 +1,83 @@ +// 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/default_container_layout_manager.h" + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "ui/aura/test/aura_test_base.h" +#include "ui/aura/desktop.h" +#include "ui/aura/screen_aura.h" +#include "ui/aura/window.h" + +namespace aura_shell { +namespace test { + +namespace { + +class DefaultContainerLayoutManagerTest : public aura::test::AuraTestBase { + public: + DefaultContainerLayoutManagerTest() {} + virtual ~DefaultContainerLayoutManagerTest() {} + + virtual void SetUp() OVERRIDE { + aura::test::AuraTestBase::SetUp(); + aura::Desktop* desktop = aura::Desktop::GetInstance(); + container_.reset( + CreateTestWindow(gfx::Rect(0, 0, 500, 400), desktop)); + // draggable area is 0,0 500x400. + container_->SetLayoutManager( + new aura_shell::internal::DefaultContainerLayoutManager( + container_.get())); + } + + aura::Window* CreateTestWindow(const gfx::Rect& bounds, + aura::Window* parent) { + aura::Window* window = new aura::Window(NULL); + window->Init(); + window->SetBounds(bounds); + window->Show(); + window->SetParent(parent); + return window; + } + + aura::Window* container() { return container_.get(); } + + private: + scoped_ptr<aura::Window> container_; + + DISALLOW_COPY_AND_ASSIGN(DefaultContainerLayoutManagerTest); +}; + +} // namespace + +TEST_F(DefaultContainerLayoutManagerTest, SetBounds) { + // Layout Manager moves the window to (0,0) to fit to draggable area. + scoped_ptr<aura::Window> child( + CreateTestWindow(gfx::Rect(0, -1000, 100, 100), container())); + EXPECT_EQ("0,0 100x100", child->bounds().ToString()); + + // DCLM enforces the window height can't be taller than its owner's height. + child->SetBounds(gfx::Rect(0, 0, 100, 500)); + EXPECT_EQ("0,0 100x400", child->bounds().ToString()); + + // DCLM enforces the window width can't be wider than its owner's width. + child->SetBounds(gfx::Rect(0, 0, 900, 500)); + EXPECT_EQ("0,0 500x400", child->bounds().ToString()); + + // Y origin must always be the top of drag area. + child->SetBounds(gfx::Rect(0, 500, 900, 500)); + EXPECT_EQ("0,0 500x400", child->bounds().ToString()); + child->SetBounds(gfx::Rect(0, -500, 900, 500)); + EXPECT_EQ("0,0 500x400", child->bounds().ToString()); + + // X origin can be anywhere. + child->SetBounds(gfx::Rect(-100, 500, 900, 500)); + EXPECT_EQ("-100,0 500x400", child->bounds().ToString()); + child->SetBounds(gfx::Rect(1000, 500, 900, 500)); + EXPECT_EQ("1000,0 500x400", child->bounds().ToString()); +} + +} // namespace test +} // namespace aura_shell diff --git a/ui/aura_shell/desktop_layout_manager.cc b/ui/aura_shell/desktop_layout_manager.cc index 8e0dc0f..ce14ae0 100644 --- a/ui/aura_shell/desktop_layout_manager.cc +++ b/ui/aura_shell/desktop_layout_manager.cc @@ -50,5 +50,20 @@ void DesktopLayoutManager::OnWindowResized() { status_area_bounds.height())); } +void DesktopLayoutManager::OnWindowAdded(aura::Window* child) { +} + +void DesktopLayoutManager::OnWillRemoveWindow(aura::Window* child) { +} + +void DesktopLayoutManager::OnChildWindowVisibilityChanged(aura::Window* child, + bool visibile) { +} + +void DesktopLayoutManager::CalculateBoundsForChild( + aura::Window* child, gfx::Rect* requested_bounds) { +} + + } // namespace internal } // namespace aura_shell diff --git a/ui/aura_shell/desktop_layout_manager.h b/ui/aura_shell/desktop_layout_manager.h index 28e1f02..5d58a71 100644 --- a/ui/aura_shell/desktop_layout_manager.h +++ b/ui/aura_shell/desktop_layout_manager.h @@ -13,6 +13,9 @@ namespace aura { class Window; } +namespace gfx { +class Rect; +} namespace views { class Widget; } @@ -42,6 +45,12 @@ class DesktopLayoutManager : public aura::LayoutManager { private: // Overridden from aura::LayoutManager: virtual void OnWindowResized() OVERRIDE; + virtual void OnWindowAdded(aura::Window* child) OVERRIDE; + virtual void OnWillRemoveWindow(aura::Window* child) OVERRIDE; + virtual void OnChildWindowVisibilityChanged(aura::Window* child, + bool visibile) OVERRIDE; + virtual void CalculateBoundsForChild(aura::Window* child, + gfx::Rect* requested_bounds) OVERRIDE; aura::Window* owner_; diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc index a44d5eb..115cb56 100644 --- a/ui/aura_shell/shell.cc +++ b/ui/aura_shell/shell.cc @@ -10,6 +10,7 @@ #include "ui/aura/toplevel_window_container.h" #include "ui/aura/window.h" #include "ui/aura/window_types.h" +#include "ui/aura_shell/default_container_layout_manager.h" #include "ui/aura_shell/desktop_layout_manager.h" #include "ui/aura_shell/launcher/launcher.h" #include "ui/aura_shell/shell_delegate.h" @@ -33,6 +34,8 @@ void CreateSpecialContainers(aura::Window::Windows* containers) { aura::Window* default_container = new aura::ToplevelWindowContainer; default_container->set_id(internal::kShellWindowId_DefaultContainer); + default_container->SetLayoutManager( + new internal::DefaultContainerLayoutManager(default_container)); containers->push_back(default_container); aura::Window* always_on_top_container = new aura::ToplevelWindowContainer; @@ -158,8 +161,10 @@ void Shell::Init() { AsToplevelWindowContainer(); launcher_.reset(new Launcher(toplevel_container)); desktop_layout->set_launcher_widget(launcher_->widget()); - desktop_layout->set_status_area_widget(internal::CreateStatusArea()); - aura::Desktop::GetInstance()->screen()->set_work_area_insets( + views::Widget* status_area_widget = internal::CreateStatusArea(); + desktop_layout->set_status_area_widget(status_area_widget); + aura::ScreenAura* screen = aura::Desktop::GetInstance()->screen(); + screen->set_work_area_insets( gfx::Insets(0, 0, launcher_->widget()->GetWindowScreenBounds().height(), 0)); } |