| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/panel_window_resizer.h" | 5 #include "ash/wm/panels/panel_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/shelf/shelf.h" | 7 #include "ash/shelf/shelf.h" |
| 8 #include "ash/shelf/shelf_types.h" | 8 #include "ash/shelf/shelf_types.h" |
| 9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
| 10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 gfx::Point* offset) { | 119 gfx::Point* offset) { |
| 120 bool should_attach = false; | 120 bool should_attach = false; |
| 121 if (panel_container_) { | 121 if (panel_container_) { |
| 122 PanelLayoutManager* panel_layout_manager = | 122 PanelLayoutManager* panel_layout_manager = |
| 123 PanelLayoutManager::Get(panel_container_); | 123 PanelLayoutManager::Get(panel_container_); |
| 124 gfx::Rect launcher_bounds = GetTarget()->GetParent()->ConvertRectFromScreen( | 124 gfx::Rect launcher_bounds = GetTarget()->GetParent()->ConvertRectFromScreen( |
| 125 panel_layout_manager->shelf() | 125 panel_layout_manager->shelf() |
| 126 ->shelf_widget() | 126 ->shelf_widget() |
| 127 ->GetWindowBoundsInScreen()); | 127 ->GetWindowBoundsInScreen()); |
| 128 switch (panel_layout_manager->shelf()->alignment()) { | 128 switch (panel_layout_manager->shelf()->alignment()) { |
| 129 case SHELF_ALIGNMENT_BOTTOM: | 129 case wm::SHELF_ALIGNMENT_BOTTOM: |
| 130 case SHELF_ALIGNMENT_BOTTOM_LOCKED: | 130 case wm::SHELF_ALIGNMENT_BOTTOM_LOCKED: |
| 131 if (bounds.bottom() >= (launcher_bounds.y() - | 131 if (bounds.bottom() >= (launcher_bounds.y() - |
| 132 kPanelSnapToLauncherDistance)) { | 132 kPanelSnapToLauncherDistance)) { |
| 133 should_attach = true; | 133 should_attach = true; |
| 134 offset->set_y(launcher_bounds.y() - bounds.height() - bounds.y()); | 134 offset->set_y(launcher_bounds.y() - bounds.height() - bounds.y()); |
| 135 } | 135 } |
| 136 break; | 136 break; |
| 137 case SHELF_ALIGNMENT_LEFT: | 137 case wm::SHELF_ALIGNMENT_LEFT: |
| 138 if (bounds.x() <= (launcher_bounds.right() + | 138 if (bounds.x() <= (launcher_bounds.right() + |
| 139 kPanelSnapToLauncherDistance)) { | 139 kPanelSnapToLauncherDistance)) { |
| 140 should_attach = true; | 140 should_attach = true; |
| 141 offset->set_x(launcher_bounds.right() - bounds.x()); | 141 offset->set_x(launcher_bounds.right() - bounds.x()); |
| 142 } | 142 } |
| 143 break; | 143 break; |
| 144 case SHELF_ALIGNMENT_RIGHT: | 144 case wm::SHELF_ALIGNMENT_RIGHT: |
| 145 if (bounds.right() >= (launcher_bounds.x() - | 145 if (bounds.right() >= (launcher_bounds.x() - |
| 146 kPanelSnapToLauncherDistance)) { | 146 kPanelSnapToLauncherDistance)) { |
| 147 should_attach = true; | 147 should_attach = true; |
| 148 offset->set_x(launcher_bounds.x() - bounds.width() - bounds.x()); | 148 offset->set_x(launcher_bounds.x() - bounds.width() - bounds.x()); |
| 149 } | 149 } |
| 150 break; | 150 break; |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 return should_attach; | 153 return should_attach; |
| 154 } | 154 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 void PanelWindowResizer::UpdateLauncherPosition() { | 201 void PanelWindowResizer::UpdateLauncherPosition() { |
| 202 if (panel_container_) { | 202 if (panel_container_) { |
| 203 PanelLayoutManager::Get(panel_container_) | 203 PanelLayoutManager::Get(panel_container_) |
| 204 ->shelf() | 204 ->shelf() |
| 205 ->UpdateIconPositionForWindow( | 205 ->UpdateIconPositionForWindow( |
| 206 wm::WmWindowAura::GetAuraWindow(GetTarget())); | 206 wm::WmWindowAura::GetAuraWindow(GetTarget())); |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace ash | 210 } // namespace ash |
| OLD | NEW |