| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/wm/panels/attached_panel_window_targeter.h" | 5 #include "ash/wm/panels/attached_panel_window_targeter.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_shelf_aura.h" | |
| 8 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shelf/wm_shelf.h" |
| 9 #include "ash/common/wm/panels/panel_layout_manager.h" | 9 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/shelf/shelf.h" | 11 #include "ash/shelf/shelf.h" |
| 12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 13 | 13 |
| 14 namespace ash { | 14 namespace ash { |
| 15 | 15 |
| 16 AttachedPanelWindowTargeter::AttachedPanelWindowTargeter( | 16 AttachedPanelWindowTargeter::AttachedPanelWindowTargeter( |
| 17 aura::Window* container, | 17 aura::Window* container, |
| 18 const gfx::Insets& default_mouse_extend, | 18 const gfx::Insets& default_mouse_extend, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 46 } | 46 } |
| 47 | 47 |
| 48 void AttachedPanelWindowTargeter::UpdateTouchExtend(aura::Window* root_window) { | 48 void AttachedPanelWindowTargeter::UpdateTouchExtend(aura::Window* root_window) { |
| 49 // Only update the touch insets for panels if they are attached to the shelf | 49 // Only update the touch insets for panels if they are attached to the shelf |
| 50 // in |root_window|. | 50 // in |root_window|. |
| 51 if (panel_container_->GetRootWindow() != root_window) | 51 if (panel_container_->GetRootWindow() != root_window) |
| 52 return; | 52 return; |
| 53 | 53 |
| 54 DCHECK(panel_layout_manager_->shelf()); | 54 DCHECK(panel_layout_manager_->shelf()); |
| 55 gfx::Insets touch(default_touch_extend_); | 55 gfx::Insets touch(default_touch_extend_); |
| 56 set_touch_extend( | 56 switch (panel_layout_manager_->shelf()->GetAlignment()) { |
| 57 WmShelfAura::GetShelf(panel_layout_manager_->shelf()) | 57 case SHELF_ALIGNMENT_BOTTOM: |
| 58 ->SelectValueForShelfAlignment( | 58 case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
| 59 gfx::Insets(touch.top(), touch.left(), 0, touch.right()), | 59 set_touch_extend( |
| 60 gfx::Insets(touch.top(), 0, touch.bottom(), touch.right()), | 60 gfx::Insets(touch.top(), touch.left(), 0, touch.right())); |
| 61 gfx::Insets(touch.top(), touch.left(), touch.bottom(), 0))); | 61 break; |
| 62 case SHELF_ALIGNMENT_LEFT: |
| 63 set_touch_extend( |
| 64 gfx::Insets(touch.top(), 0, touch.bottom(), touch.right())); |
| 65 break; |
| 66 case SHELF_ALIGNMENT_RIGHT: |
| 67 set_touch_extend( |
| 68 gfx::Insets(touch.top(), touch.left(), touch.bottom(), 0)); |
| 69 break; |
| 70 } |
| 62 } | 71 } |
| 63 | 72 |
| 64 } // namespace ash | 73 } // namespace ash |
| OLD | NEW |