diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-11 02:10:42 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-11 02:10:42 +0000 |
commit | 0c4011b93ad687c5087589a04220b804d086acbe (patch) | |
tree | 01c6d548aa4ef11760e72cbf0ecbcc02dd63de41 /ash | |
parent | d24fc3a01519bb8894321a53935f127face2af28 (diff) | |
download | chromium_src-0c4011b93ad687c5087589a04220b804d086acbe.zip chromium_src-0c4011b93ad687c5087589a04220b804d086acbe.tar.gz chromium_src-0c4011b93ad687c5087589a04220b804d086acbe.tar.bz2 |
aura: Update status area position in compact mode.
This makes us adjust the position of the status area when it
compact mode depending on whether we're currently showing
the login/lock screen or not.
BUG=113001
TEST=added; also did manual testing
Review URL: http://codereview.chromium.org/9379024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121616 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/shell.cc | 12 | ||||
-rw-r--r-- | ash/shell.h | 14 | ||||
-rw-r--r-- | ash/wm/compact_status_area_layout_manager.cc | 18 |
3 files changed, 30 insertions, 14 deletions
diff --git a/ash/shell.cc b/ash/shell.cc index 6874ca0..f5f2246 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -451,6 +451,18 @@ bool Shell::IsModalWindowOpen() const { return !modal_container->children().empty(); } +void Shell::SetCompactStatusAreaOffset(gfx::Size& offset) { + compact_status_area_offset_ = offset; + + // Trigger a relayout. + if (IsWindowModeCompact()) { + aura::LayoutManager* layout_manager = GetContainer( + internal::kShellWindowId_StatusContainer)->layout_manager(); + if (layout_manager) + layout_manager->OnWindowResized(); + } +} + views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView( views::Widget* widget) { if (CommandLine::ForCurrentProcess()->HasSwitch( diff --git a/ash/shell.h b/ash/shell.h index 853f2e1..833cfee 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -15,6 +15,7 @@ #include "base/memory/scoped_ptr.h" #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" +#include "ui/gfx/size.h" class CommandLine; @@ -26,7 +27,6 @@ class Window; namespace gfx { class Point; class Rect; -class Size; } namespace views { class NonClientFrameView; @@ -89,6 +89,10 @@ class ASH_EXPORT Shell { static void DeleteInstance(); + const gfx::Size& compact_status_area_offset() const { + return compact_status_area_offset_; + } + aura::Window* GetContainer(int container_id); const aura::Window* GetContainer(int container_id) const; @@ -120,6 +124,10 @@ class ASH_EXPORT Shell { // See enum WindowMode for details. bool IsWindowModeCompact() const { return window_mode_ == MODE_COMPACT; } + // Sets the offset between the corner of the status area and the corner of the + // screen when we're using the compact window mode. + void SetCompactStatusAreaOffset(gfx::Size& offset); + // Creates a default views::NonClientFrameView for use by windows in the // Ash environment. views::NonClientFrameView* CreateDefaultNonClientFrameView( @@ -237,6 +245,10 @@ class ASH_EXPORT Shell { // Locks shell to overlapping window mode despite host window size. static bool window_mode_overlapping_for_test_; + // Offset between the corner of the status area and the corner of the screen + // when in the compact window mode. + gfx::Size compact_status_area_offset_; + DISALLOW_COPY_AND_ASSIGN(Shell); }; diff --git a/ash/wm/compact_status_area_layout_manager.cc b/ash/wm/compact_status_area_layout_manager.cc index 7be8f14..5e2fcc8 100644 --- a/ash/wm/compact_status_area_layout_manager.cc +++ b/ash/wm/compact_status_area_layout_manager.cc @@ -4,22 +4,13 @@ #include "ash/wm/compact_status_area_layout_manager.h" +#include "ash/shell.h" #include "base/auto_reset.h" #include "base/i18n/rtl.h" #include "ui/gfx/rect.h" #include "ui/gfx/screen.h" #include "ui/views/widget/widget.h" -namespace { - -// Padding between the side of status area and the side of screen. -const int kSideEdgePad = 3; - -// Padding between the top of the status area and the top of the screen. -const int kTopEdgePad = 2; - -} // namespace - namespace ash { namespace internal { @@ -69,15 +60,16 @@ void CompactStatusAreaLayoutManager::LayoutStatusArea() { AutoReset<bool> auto_reset_in_layout(&in_layout_, true); gfx::Rect monitor_bounds = gfx::Screen::GetPrimaryMonitorBounds(); gfx::Rect widget_bounds = status_widget_->GetRestoredBounds(); + gfx::Size offset = ash::Shell::GetInstance()->compact_status_area_offset(); if (base::i18n::IsRTL()) { // Place the widget in the top-left corner of the screen. - widget_bounds.set_x(monitor_bounds.x() + kSideEdgePad); + widget_bounds.set_x(monitor_bounds.x() + offset.width()); } else { // Place the widget in the top-right corner of the screen. widget_bounds.set_x( - monitor_bounds.right() - widget_bounds.width() - kSideEdgePad); + monitor_bounds.right() - widget_bounds.width() - offset.width()); } - widget_bounds.set_y(kTopEdgePad); + widget_bounds.set_y(offset.height()); status_widget_->SetBounds(widget_bounds); } |