| 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/common/shelf/wm_shelf.h" | 7 #include "ash/common/shelf/wm_shelf.h" |
| 8 #include "ash/common/wm/panels/panel_layout_manager.h" | 8 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 9 #include "ash/common/wm_shell.h" | |
| 10 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 10 #include "ash/shell.h" |
| 11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace ash { |
| 14 | 14 |
| 15 AttachedPanelWindowTargeter::AttachedPanelWindowTargeter( | 15 AttachedPanelWindowTargeter::AttachedPanelWindowTargeter( |
| 16 aura::Window* container, | 16 aura::Window* container, |
| 17 const gfx::Insets& default_mouse_extend, | 17 const gfx::Insets& default_mouse_extend, |
| 18 const gfx::Insets& default_touch_extend, | 18 const gfx::Insets& default_touch_extend, |
| 19 PanelLayoutManager* panel_layout_manager) | 19 PanelLayoutManager* panel_layout_manager) |
| 20 : ::wm::EasyResizeWindowTargeter(container, | 20 : ::wm::EasyResizeWindowTargeter(container, |
| 21 default_mouse_extend, | 21 default_mouse_extend, |
| 22 default_touch_extend), | 22 default_touch_extend), |
| 23 panel_container_(container), | 23 panel_container_(container), |
| 24 panel_layout_manager_(panel_layout_manager), | 24 panel_layout_manager_(panel_layout_manager), |
| 25 default_touch_extend_(default_touch_extend) { | 25 default_touch_extend_(default_touch_extend) { |
| 26 WmShell::Get()->AddShellObserver(this); | 26 Shell::GetInstance()->AddShellObserver(this); |
| 27 } | 27 } |
| 28 | 28 |
| 29 AttachedPanelWindowTargeter::~AttachedPanelWindowTargeter() { | 29 AttachedPanelWindowTargeter::~AttachedPanelWindowTargeter() { |
| 30 WmShell::Get()->RemoveShellObserver(this); | 30 Shell::GetInstance()->RemoveShellObserver(this); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void AttachedPanelWindowTargeter::OnShelfCreatedForRootWindow( | 33 void AttachedPanelWindowTargeter::OnShelfCreatedForRootWindow( |
| 34 WmWindow* root_window) { | 34 WmWindow* root_window) { |
| 35 UpdateTouchExtend(WmWindow::GetAuraWindow(root_window)); | 35 UpdateTouchExtend(WmWindow::GetAuraWindow(root_window)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void AttachedPanelWindowTargeter::OnShelfAlignmentChanged( | 38 void AttachedPanelWindowTargeter::OnShelfAlignmentChanged( |
| 39 WmWindow* root_window) { | 39 WmWindow* root_window) { |
| 40 // Don't update the touch insets if the shelf has not yet been created. | 40 // Don't update the touch insets if the shelf has not yet been created. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 63 gfx::Insets(touch.top(), 0, touch.bottom(), touch.right())); | 63 gfx::Insets(touch.top(), 0, touch.bottom(), touch.right())); |
| 64 break; | 64 break; |
| 65 case SHELF_ALIGNMENT_RIGHT: | 65 case SHELF_ALIGNMENT_RIGHT: |
| 66 set_touch_extend( | 66 set_touch_extend( |
| 67 gfx::Insets(touch.top(), touch.left(), touch.bottom(), 0)); | 67 gfx::Insets(touch.top(), touch.left(), touch.bottom(), 0)); |
| 68 break; | 68 break; |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace ash | 72 } // namespace ash |
| OLD | NEW |