| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/shelf/shelf_window_targeter.h" | 5 #include "ash/shelf/shelf_window_targeter.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/shelf_types.h" | 7 #include "ash/public/cpp/shelf_types.h" |
| 8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
| 9 #include "ash/shelf/shelf_constants.h" | 9 #include "ash/shelf/shelf_constants.h" |
| 10 #include "ash/wm_window.h" | |
| 11 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 12 | 11 |
| 13 namespace ash { | 12 namespace ash { |
| 14 | 13 |
| 15 namespace { | 14 namespace { |
| 16 | 15 |
| 17 gfx::Insets GetInsetsForAlignment(int distance, ShelfAlignment alignment) { | 16 gfx::Insets GetInsetsForAlignment(int distance, ShelfAlignment alignment) { |
| 18 if (alignment == SHELF_ALIGNMENT_LEFT) | 17 if (alignment == SHELF_ALIGNMENT_LEFT) |
| 19 return gfx::Insets(0, 0, 0, distance); | 18 return gfx::Insets(0, 0, 0, distance); |
| 20 if (alignment == SHELF_ALIGNMENT_RIGHT) | 19 if (alignment == SHELF_ALIGNMENT_RIGHT) |
| 21 return gfx::Insets(0, distance, 0, 0); | 20 return gfx::Insets(0, distance, 0, 0); |
| 22 return gfx::Insets(distance, 0, 0, 0); | 21 return gfx::Insets(distance, 0, 0, 0); |
| 23 } | 22 } |
| 24 | 23 |
| 25 } // namespace | 24 } // namespace |
| 26 | 25 |
| 27 ShelfWindowTargeter::ShelfWindowTargeter(WmWindow* container, Shelf* shelf) | 26 ShelfWindowTargeter::ShelfWindowTargeter(aura::Window* container, Shelf* shelf) |
| 28 : ::wm::EasyResizeWindowTargeter(WmWindow::GetAuraWindow(container), | 27 : ::wm::EasyResizeWindowTargeter(container, gfx::Insets(), gfx::Insets()), |
| 29 gfx::Insets(), | |
| 30 gfx::Insets()), | |
| 31 shelf_(shelf) { | 28 shelf_(shelf) { |
| 32 WillChangeVisibilityState(shelf_->GetVisibilityState()); | 29 WillChangeVisibilityState(shelf_->GetVisibilityState()); |
| 33 container->aura_window()->AddObserver(this); | 30 container->AddObserver(this); |
| 34 shelf_->AddObserver(this); | 31 shelf_->AddObserver(this); |
| 35 } | 32 } |
| 36 | 33 |
| 37 ShelfWindowTargeter::~ShelfWindowTargeter() { | 34 ShelfWindowTargeter::~ShelfWindowTargeter() { |
| 38 // Ensure that the observers were removed and the shelf pointer was cleared. | 35 // Ensure that the observers were removed and the shelf pointer was cleared. |
| 39 DCHECK(!shelf_); | 36 DCHECK(!shelf_); |
| 40 } | 37 } |
| 41 | 38 |
| 42 void ShelfWindowTargeter::OnWindowDestroying(aura::Window* window) { | 39 void ShelfWindowTargeter::OnWindowDestroying(aura::Window* window) { |
| 43 window->RemoveObserver(this); | 40 window->RemoveObserver(this); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 59 // while hidden. | 56 // while hidden. |
| 60 touch_insets = GetInsetsForAlignment(-kWorkspaceAreaAutoHideInset, | 57 touch_insets = GetInsetsForAlignment(-kWorkspaceAreaAutoHideInset, |
| 61 shelf_->alignment()); | 58 shelf_->alignment()); |
| 62 } | 59 } |
| 63 | 60 |
| 64 set_mouse_extend(mouse_insets); | 61 set_mouse_extend(mouse_insets); |
| 65 set_touch_extend(touch_insets); | 62 set_touch_extend(touch_insets); |
| 66 } | 63 } |
| 67 | 64 |
| 68 } // namespace ash | 65 } // namespace ash |
| OLD | NEW |