| 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/drag_window_resizer.h" | 5 #include "ash/wm/drag_window_resizer.h" |
| 6 | 6 |
| 7 #include "ash/display/mouse_cursor_event_filter.h" | 7 #include "ash/display/mouse_cursor_event_filter.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 drag_window_controller_->SetOpacity(phantom_opacity); | 205 drag_window_controller_->SetOpacity(phantom_opacity); |
| 206 GetTarget()->layer()->SetOpacity(window_opacity); | 206 GetTarget()->layer()->SetOpacity(window_opacity); |
| 207 } else { | 207 } else { |
| 208 drag_window_controller_.reset(); | 208 drag_window_controller_.reset(); |
| 209 GetTarget()->layer()->SetOpacity(1.0f); | 209 GetTarget()->layer()->SetOpacity(1.0f); |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 bool DragWindowResizer::ShouldAllowMouseWarp() { | 213 bool DragWindowResizer::ShouldAllowMouseWarp() { |
| 214 return (details_.window_component == HTCAPTION) && | 214 return (details_.window_component == HTCAPTION) && |
| 215 !GetTarget()->transient_parent() && | 215 !GetTarget()->transient_parent() && |
| 216 (GetTarget()->type() == aura::client::WINDOW_TYPE_NORMAL || | 216 (GetTarget()->type() == ui::wm::WINDOW_TYPE_NORMAL || |
| 217 GetTarget()->type() == aura::client::WINDOW_TYPE_PANEL); | 217 GetTarget()->type() == ui::wm::WINDOW_TYPE_PANEL); |
| 218 } | 218 } |
| 219 | 219 |
| 220 TrayUser* DragWindowResizer::GetTrayUserItemAtPoint( | 220 TrayUser* DragWindowResizer::GetTrayUserItemAtPoint( |
| 221 const gfx::Point& point_in_screen) { | 221 const gfx::Point& point_in_screen) { |
| 222 // Unit tests might not have an ash shell. | 222 // Unit tests might not have an ash shell. |
| 223 if (!ash::Shell::GetInstance()) | 223 if (!ash::Shell::GetInstance()) |
| 224 return NULL; | 224 return NULL; |
| 225 | 225 |
| 226 // Check that this is a drag move operation from a suitable window. | 226 // Check that this is a drag move operation from a suitable window. |
| 227 if (details_.window_component != HTCAPTION || | 227 if (details_.window_component != HTCAPTION || |
| 228 GetTarget()->transient_parent() || | 228 GetTarget()->transient_parent() || |
| 229 (GetTarget()->type() != aura::client::WINDOW_TYPE_NORMAL && | 229 (GetTarget()->type() != ui::wm::WINDOW_TYPE_NORMAL && |
| 230 GetTarget()->type() != aura::client::WINDOW_TYPE_PANEL && | 230 GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL && |
| 231 GetTarget()->type() != aura::client::WINDOW_TYPE_POPUP)) | 231 GetTarget()->type() != ui::wm::WINDOW_TYPE_POPUP)) |
| 232 return NULL; | 232 return NULL; |
| 233 | 233 |
| 234 // We only allow to drag the window onto a tray of it's own RootWindow. | 234 // We only allow to drag the window onto a tray of it's own RootWindow. |
| 235 SystemTray* tray = internal::GetRootWindowController( | 235 SystemTray* tray = internal::GetRootWindowController( |
| 236 details_.window->GetRootWindow())->GetSystemTray(); | 236 details_.window->GetRootWindow())->GetSystemTray(); |
| 237 | 237 |
| 238 // Again - unit tests might not have a tray. | 238 // Again - unit tests might not have a tray. |
| 239 if (!tray) | 239 if (!tray) |
| 240 return NULL; | 240 return NULL; |
| 241 | 241 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 268 if (!tray_user->TransferWindowToUser(details_.window)) { | 268 if (!tray_user->TransferWindowToUser(details_.window)) { |
| 269 GetTarget()->layer()->SetOpacity(old_opacity); | 269 GetTarget()->layer()->SetOpacity(old_opacity); |
| 270 return false; | 270 return false; |
| 271 } | 271 } |
| 272 RevertDrag(); | 272 RevertDrag(); |
| 273 return true; | 273 return true; |
| 274 } | 274 } |
| 275 | 275 |
| 276 } // namespace internal | 276 } // namespace internal |
| 277 } // namespace ash | 277 } // namespace ash |
| OLD | NEW |