diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-18 16:26:10 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-18 16:26:10 +0000 |
commit | 1ca79d4a521fdad4067298110a4f346f0629f6a3 (patch) | |
tree | a34c08c64ef5827e14cbd4d77f488e3622bf55df /ash/shelf | |
parent | 388f6742bf424d0f7c627250d222465f60e7698d (diff) | |
download | chromium_src-1ca79d4a521fdad4067298110a4f346f0629f6a3.zip chromium_src-1ca79d4a521fdad4067298110a4f346f0629f6a3.tar.gz chromium_src-1ca79d4a521fdad4067298110a4f346f0629f6a3.tar.bz2 |
Snap widgets to pixel boundary on ash
Introduced SnapToPixelLayoutManager and used where it makes sense.
WorkspaceLayoutManager uses WindowState, so it's the property is manually set there.
This depends on the following CL:
https://codereview.chromium.org/375693006/
BUG=391822
Review URL: https://codereview.chromium.org/357063002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284119 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shelf')
-rw-r--r-- | ash/shelf/shelf_layout_manager.cc | 18 | ||||
-rw-r--r-- | ash/shelf/shelf_layout_manager.h | 25 | ||||
-rw-r--r-- | ash/shelf/shelf_widget.cc | 3 |
3 files changed, 15 insertions, 31 deletions
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index 4f5358f..e606732 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc @@ -187,7 +187,8 @@ class ShelfLayoutManager::UpdateShelfObserver // ShelfLayoutManager ---------------------------------------------------------- ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf) - : root_window_(shelf->GetNativeView()->GetRootWindow()), + : SnapToPixelLayoutManager(shelf->GetNativeView()->parent()), + root_window_(shelf->GetNativeView()->GetRootWindow()), updating_bounds_(false), auto_hide_behavior_(SHELF_AUTO_HIDE_BEHAVIOR_NEVER), alignment_(SHELF_ALIGNMENT_BOTTOM), @@ -515,22 +516,9 @@ void ShelfLayoutManager::OnWindowResized() { LayoutShelf(); } -void ShelfLayoutManager::OnWindowAddedToLayout(aura::Window* child) { -} - -void ShelfLayoutManager::OnWillRemoveWindowFromLayout(aura::Window* child) { -} - -void ShelfLayoutManager::OnWindowRemovedFromLayout(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); + SnapToPixelLayoutManager::SetChildBounds(child, requested_bounds); // We may contain other widgets (such as frame maximize bubble) but they don't // effect the layout in anyway. if (!updating_bounds_ && diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h index cac6144e..32f4e7b 100644 --- a/ash/shelf/shelf_layout_manager.h +++ b/ash/shelf/shelf_layout_manager.h @@ -13,6 +13,7 @@ #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_types.h" #include "ash/shell_observer.h" +#include "ash/snap_to_pixel_layout_manager.h" #include "ash/system/status_area_widget.h" #include "ash/wm/dock/docked_window_layout_manager_observer.h" #include "ash/wm/lock_state_observer.h" @@ -22,7 +23,6 @@ #include "base/logging.h" #include "base/observer_list.h" #include "base/timer/timer.h" -#include "ui/aura/layout_manager.h" #include "ui/gfx/insets.h" #include "ui/gfx/rect.h" #include "ui/keyboard/keyboard_controller.h" @@ -56,14 +56,14 @@ FORWARD_DECLARE_TEST(WebNotificationTrayTest, PopupAndFullscreen); // layout to the status area. // To respond to bounds changes in the status area StatusAreaLayoutManager works // closely with ShelfLayoutManager. -class ASH_EXPORT ShelfLayoutManager : - public aura::LayoutManager, - public ash::ShellObserver, - public aura::client::ActivationChangeObserver, - public DockedWindowLayoutManagerObserver, - public keyboard::KeyboardControllerObserver, - public LockStateObserver, - public SessionStateObserver { +class ASH_EXPORT ShelfLayoutManager + : public ash::ShellObserver, + public aura::client::ActivationChangeObserver, + public DockedWindowLayoutManagerObserver, + public keyboard::KeyboardControllerObserver, + public LockStateObserver, + public SnapToPixelLayoutManager, + public SessionStateObserver { public: // We reserve a small area on the edge of the workspace area to ensure that @@ -164,13 +164,8 @@ class ASH_EXPORT ShelfLayoutManager : // shelf. Specifying 0 leads to use the default. void SetAnimationDurationOverride(int duration_override_in_ms); - // Overridden from aura::LayoutManager: + // Overridden from SnapLayoutManager: virtual void OnWindowResized() OVERRIDE; - virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; - virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; - virtual void OnWindowRemovedFromLayout(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; diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc index 0f47ac2..e16244c 100644 --- a/ash/shelf/shelf_widget.cc +++ b/ash/shelf/shelf_widget.cc @@ -630,7 +630,8 @@ ShelfWidget::ShelfWidget(aura::Window* shelf_container, shelf_layout_manager_->set_workspace_controller(workspace_controller); workspace_controller->SetShelf(shelf_layout_manager_); - status_container->SetLayoutManager(new StatusAreaLayoutManager(this)); + status_container->SetLayoutManager( + new StatusAreaLayoutManager(status_container, this)); shelf_container->SetEventTargeter(scoped_ptr<ui::EventTargeter>(new ShelfWindowTargeter(shelf_container, shelf_layout_manager_))); |