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/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/public/cpp/window_properties.h" | 8 #include "ash/public/cpp/window_properties.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/shelf/wm_shelf.h" | 10 #include "ash/shelf/shelf.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/wm/panels/panel_layout_manager.h" | 12 #include "ash/wm/panels/panel_layout_manager.h" |
13 #include "ash/wm/window_parenting_utils.h" | 13 #include "ash/wm/window_parenting_utils.h" |
14 #include "ash/wm/window_state.h" | 14 #include "ash/wm/window_state.h" |
15 #include "ash/wm_window.h" | 15 #include "ash/wm_window.h" |
16 #include "ui/aura/client/window_parenting_client.h" | 16 #include "ui/aura/client/window_parenting_client.h" |
17 #include "ui/base/hit_test.h" | 17 #include "ui/base/hit_test.h" |
18 #include "ui/base/ui_base_types.h" | 18 #include "ui/base/ui_base_types.h" |
19 #include "ui/display/display.h" | 19 #include "ui/display/display.h" |
20 #include "ui/display/screen.h" | 20 #include "ui/display/screen.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 bool PanelWindowResizer::AttachToLauncher(const gfx::Rect& bounds, | 119 bool PanelWindowResizer::AttachToLauncher(const gfx::Rect& bounds, |
120 gfx::Point* offset) { | 120 gfx::Point* offset) { |
121 bool should_attach = false; | 121 bool should_attach = false; |
122 if (panel_container_) { | 122 if (panel_container_) { |
123 PanelLayoutManager* panel_layout_manager = GetPanelLayoutManager(); | 123 PanelLayoutManager* panel_layout_manager = GetPanelLayoutManager(); |
124 gfx::Rect launcher_bounds = | 124 gfx::Rect launcher_bounds = |
125 panel_layout_manager->shelf()->GetWindow()->GetBoundsInScreen(); | 125 panel_layout_manager->shelf()->GetWindow()->GetBoundsInScreen(); |
126 ::wm::ConvertRectFromScreen(GetTarget()->parent(), &launcher_bounds); | 126 ::wm::ConvertRectFromScreen(GetTarget()->parent(), &launcher_bounds); |
127 switch (panel_layout_manager->shelf()->GetAlignment()) { | 127 switch (panel_layout_manager->shelf()->alignment()) { |
128 case SHELF_ALIGNMENT_BOTTOM: | 128 case SHELF_ALIGNMENT_BOTTOM: |
129 case SHELF_ALIGNMENT_BOTTOM_LOCKED: | 129 case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
130 if (bounds.bottom() >= | 130 if (bounds.bottom() >= |
131 (launcher_bounds.y() - kPanelSnapToLauncherDistance)) { | 131 (launcher_bounds.y() - kPanelSnapToLauncherDistance)) { |
132 should_attach = true; | 132 should_attach = true; |
133 offset->set_y(launcher_bounds.y() - bounds.height() - bounds.y()); | 133 offset->set_y(launcher_bounds.y() - bounds.height() - bounds.y()); |
134 } | 134 } |
135 break; | 135 break; |
136 case SHELF_ALIGNMENT_LEFT: | 136 case SHELF_ALIGNMENT_LEFT: |
137 if (bounds.x() <= | 137 if (bounds.x() <= |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 GetPanelLayoutManager()->shelf()->UpdateIconPositionForPanel( | 202 GetPanelLayoutManager()->shelf()->UpdateIconPositionForPanel( |
203 WmWindow::Get(GetTarget())); | 203 WmWindow::Get(GetTarget())); |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 PanelLayoutManager* PanelWindowResizer::GetPanelLayoutManager() { | 207 PanelLayoutManager* PanelWindowResizer::GetPanelLayoutManager() { |
208 return PanelLayoutManager::Get(panel_container_); | 208 return PanelLayoutManager::Get(panel_container_); |
209 } | 209 } |
210 | 210 |
211 } // namespace ash | 211 } // namespace ash |
OLD | NEW |