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/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/launcher/launcher.h" | |
9 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
| 9 #include "ash/shelf/shelf.h" |
10 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
11 #include "ash/shelf/shelf_widget.h" | 11 #include "ash/shelf/shelf_widget.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/shell_window_ids.h" | 13 #include "ash/shell_window_ids.h" |
14 #include "ash/wm/coordinate_conversion.h" | 14 #include "ash/wm/coordinate_conversion.h" |
15 #include "ash/wm/panels/panel_layout_manager.h" | 15 #include "ash/wm/panels/panel_layout_manager.h" |
16 #include "ash/wm/window_state.h" | 16 #include "ash/wm/window_state.h" |
17 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "ui/aura/client/aura_constants.h" | 19 #include "ui/aura/client/aura_constants.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 142 } |
143 | 143 |
144 bool PanelWindowResizer::AttachToLauncher(const gfx::Rect& bounds, | 144 bool PanelWindowResizer::AttachToLauncher(const gfx::Rect& bounds, |
145 gfx::Point* offset) { | 145 gfx::Point* offset) { |
146 bool should_attach = false; | 146 bool should_attach = false; |
147 if (panel_container_) { | 147 if (panel_container_) { |
148 internal::PanelLayoutManager* panel_layout_manager = | 148 internal::PanelLayoutManager* panel_layout_manager = |
149 GetPanelLayoutManager(panel_container_); | 149 GetPanelLayoutManager(panel_container_); |
150 gfx::Rect launcher_bounds = ScreenAsh::ConvertRectFromScreen( | 150 gfx::Rect launcher_bounds = ScreenAsh::ConvertRectFromScreen( |
151 GetTarget()->parent(), | 151 GetTarget()->parent(), |
152 panel_layout_manager->launcher()-> | 152 panel_layout_manager->shelf()-> |
153 shelf_widget()->GetWindowBoundsInScreen()); | 153 shelf_widget()->GetWindowBoundsInScreen()); |
154 switch (panel_layout_manager->launcher()->alignment()) { | 154 switch (panel_layout_manager->shelf()->alignment()) { |
155 case SHELF_ALIGNMENT_BOTTOM: | 155 case SHELF_ALIGNMENT_BOTTOM: |
156 if (bounds.bottom() >= (launcher_bounds.y() - | 156 if (bounds.bottom() >= (launcher_bounds.y() - |
157 kPanelSnapToLauncherDistance)) { | 157 kPanelSnapToLauncherDistance)) { |
158 should_attach = true; | 158 should_attach = true; |
159 offset->set_y(launcher_bounds.y() - bounds.height() - bounds.y()); | 159 offset->set_y(launcher_bounds.y() - bounds.height() - bounds.y()); |
160 } | 160 } |
161 break; | 161 break; |
162 case SHELF_ALIGNMENT_LEFT: | 162 case SHELF_ALIGNMENT_LEFT: |
163 if (bounds.x() <= (launcher_bounds.right() + | 163 if (bounds.x() <= (launcher_bounds.right() + |
164 kPanelSnapToLauncherDistance)) { | 164 kPanelSnapToLauncherDistance)) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // but then canceled the drag we may need to inform the original layout | 226 // but then canceled the drag we may need to inform the original layout |
227 // manager that the drag is finished. | 227 // manager that the drag is finished. |
228 if (initial_panel_container_ != panel_container_) | 228 if (initial_panel_container_ != panel_container_) |
229 GetPanelLayoutManager(initial_panel_container_)->FinishDragging(); | 229 GetPanelLayoutManager(initial_panel_container_)->FinishDragging(); |
230 if (panel_container_) | 230 if (panel_container_) |
231 GetPanelLayoutManager(panel_container_)->FinishDragging(); | 231 GetPanelLayoutManager(panel_container_)->FinishDragging(); |
232 } | 232 } |
233 | 233 |
234 void PanelWindowResizer::UpdateLauncherPosition() { | 234 void PanelWindowResizer::UpdateLauncherPosition() { |
235 if (panel_container_) { | 235 if (panel_container_) { |
236 GetPanelLayoutManager(panel_container_)->launcher()-> | 236 GetPanelLayoutManager(panel_container_)->shelf()-> |
237 UpdateIconPositionForWindow(GetTarget()); | 237 UpdateIconPositionForWindow(GetTarget()); |
238 } | 238 } |
239 } | 239 } |
240 | 240 |
241 } // namespace aura | 241 } // namespace aura |
OLD | NEW |