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/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shelf_types.h" | 9 #include "ash/shelf/shelf_types.h" |
| 10 #include "ash/shelf/shelf_widget.h" |
10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
11 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
12 #include "ash/wm/panels/panel_layout_manager.h" | 13 #include "ash/wm/panels/panel_layout_manager.h" |
13 #include "ash/wm/property_util.h" | 14 #include "ash/wm/property_util.h" |
14 #include "ash/wm/window_properties.h" | 15 #include "ash/wm/window_properties.h" |
15 #include "ui/aura/client/aura_constants.h" | 16 #include "ui/aura/client/aura_constants.h" |
16 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
17 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
18 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
19 #include "ui/aura/window_delegate.h" | 20 #include "ui/aura/window_delegate.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (panel_container_) { | 96 if (panel_container_) { |
96 panel_layout_manager_ = static_cast<internal::PanelLayoutManager*>( | 97 panel_layout_manager_ = static_cast<internal::PanelLayoutManager*>( |
97 panel_container_->layout_manager()); | 98 panel_container_->layout_manager()); |
98 } | 99 } |
99 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); | 100 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); |
100 } | 101 } |
101 | 102 |
102 bool PanelWindowResizer::AttachToLauncher(gfx::Rect* bounds) { | 103 bool PanelWindowResizer::AttachToLauncher(gfx::Rect* bounds) { |
103 bool should_attach = false; | 104 bool should_attach = false; |
104 if (panel_layout_manager_) { | 105 if (panel_layout_manager_) { |
105 gfx::Rect launcher_bounds = panel_layout_manager_->launcher()->widget()-> | 106 gfx::Rect launcher_bounds = panel_layout_manager_->launcher()-> |
106 GetWindowBoundsInScreen(); | 107 shelf_widget()->GetWindowBoundsInScreen(); |
107 switch (panel_layout_manager_->launcher()->alignment()) { | 108 switch (panel_layout_manager_->launcher()->alignment()) { |
108 case SHELF_ALIGNMENT_BOTTOM: | 109 case SHELF_ALIGNMENT_BOTTOM: |
109 if (bounds->bottom() >= (launcher_bounds.y() - | 110 if (bounds->bottom() >= (launcher_bounds.y() - |
110 kPanelSnapToLauncherDistance)) { | 111 kPanelSnapToLauncherDistance)) { |
111 should_attach = true; | 112 should_attach = true; |
112 bounds->set_y(launcher_bounds.y() - bounds->height()); | 113 bounds->set_y(launcher_bounds.y() - bounds->height()); |
113 } | 114 } |
114 break; | 115 break; |
115 case SHELF_ALIGNMENT_LEFT: | 116 case SHELF_ALIGNMENT_LEFT: |
116 if (bounds->x() <= (launcher_bounds.right() + | 117 if (bounds->x() <= (launcher_bounds.right() + |
(...skipping 25 matching lines...) Expand all Loading... |
142 if (was_attached_) | 143 if (was_attached_) |
143 panel_layout_manager_->StartDragging(details_.window); | 144 panel_layout_manager_->StartDragging(details_.window); |
144 } | 145 } |
145 | 146 |
146 void PanelWindowResizer::FinishDragging() { | 147 void PanelWindowResizer::FinishDragging() { |
147 if (was_attached_) | 148 if (was_attached_) |
148 panel_layout_manager_->FinishDragging(); | 149 panel_layout_manager_->FinishDragging(); |
149 } | 150 } |
150 | 151 |
151 } // namespace aura | 152 } // namespace aura |
OLD | NEW |