Chromium Code Reviews| Index: ash/wm/drag_window_resizer.cc |
| diff --git a/ash/wm/drag_window_resizer.cc b/ash/wm/drag_window_resizer.cc |
| index 2a859cff359b52f3aa0f699de7e1ecbef50d13be..a92ef71e29cd8a065f7eced9fbb1d51733194941 100644 |
| --- a/ash/wm/drag_window_resizer.cc |
| +++ b/ash/wm/drag_window_resizer.cc |
| @@ -58,8 +58,8 @@ aura::Window* GetAnotherRootWindow(aura::Window* root_window) { |
| DragWindowResizer* DragWindowResizer::instance_ = NULL; |
| DragWindowResizer::~DragWindowResizer() { |
| - if (GetTarget()) |
| - wm::GetWindowState(GetTarget())->set_window_resizer_(NULL); |
| + if (window_state_) |
| + window_state_->set_drag_details(NULL); |
| Shell* shell = Shell::GetInstance(); |
| shell->mouse_cursor_filter()->set_mouse_warp_mode( |
| MouseCursorEventFilter::WARP_ALWAYS); |
| @@ -71,13 +71,8 @@ DragWindowResizer::~DragWindowResizer() { |
| // static |
| DragWindowResizer* DragWindowResizer::Create( |
| WindowResizer* next_window_resizer, |
| - aura::Window* window, |
| - const gfx::Point& location, |
| - int window_component, |
| - aura::client::WindowMoveSource source) { |
| - Details details(window, location, window_component, source); |
| - return details.is_resizable ? |
| - new DragWindowResizer(next_window_resizer, details) : NULL; |
| + wm::WindowState* window_state) { |
| + return new DragWindowResizer(next_window_resizer, window_state); |
| } |
| void DragWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
| @@ -87,7 +82,7 @@ void DragWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
| // temporarily back to where it was initially and make it semi-transparent. |
| GetTarget()->layer()->SetOpacity( |
| GetTrayUserItemAtPoint(location) ? kOpacityWhenDraggedOverUserIcon : |
| - details_.initial_opacity); |
| + details().initial_opacity); |
| next_window_resizer_->Drag(location, event_flags); |
| @@ -113,7 +108,7 @@ void DragWindowResizer::CompleteDrag() { |
| next_window_resizer_->CompleteDrag(); |
| - GetTarget()->layer()->SetOpacity(details_.initial_opacity); |
| + GetTarget()->layer()->SetOpacity(details().initial_opacity); |
| drag_window_controller_.reset(); |
| // Check if the destination is another display. |
| @@ -157,21 +152,13 @@ void DragWindowResizer::RevertDrag() { |
| next_window_resizer_->RevertDrag(); |
| drag_window_controller_.reset(); |
| - GetTarget()->layer()->SetOpacity(details_.initial_opacity); |
| -} |
| - |
| -aura::Window* DragWindowResizer::GetTarget() { |
| - return next_window_resizer_->GetTarget(); |
| -} |
| - |
| -const gfx::Point& DragWindowResizer::GetInitialLocation() const { |
| - return details_.initial_location_in_parent; |
| + GetTarget()->layer()->SetOpacity(details().initial_opacity); |
| } |
| DragWindowResizer::DragWindowResizer(WindowResizer* next_window_resizer, |
| - const Details& details) |
| - : next_window_resizer_(next_window_resizer), |
| - details_(details), |
| + wm::WindowState* window_state) |
| + : WindowResizer(window_state), |
| + next_window_resizer_(next_window_resizer), |
| weak_ptr_factory_(this) { |
| // The pointer should be confined in one display during resizing a window |
| // because the window cannot span two displays at the same time anyway. The |
| @@ -183,16 +170,14 @@ DragWindowResizer::DragWindowResizer(WindowResizer* next_window_resizer, |
| mouse_cursor_filter->set_mouse_warp_mode( |
| ShouldAllowMouseWarp() ? |
| MouseCursorEventFilter::WARP_DRAG : MouseCursorEventFilter::WARP_NONE); |
| - if (ShouldAllowMouseWarp()) { |
| - mouse_cursor_filter->ShowSharedEdgeIndicator( |
| - details.window->GetRootWindow()); |
| - } |
| + if (ShouldAllowMouseWarp()) |
| + mouse_cursor_filter->ShowSharedEdgeIndicator(GetTarget()->GetRootWindow()); |
| instance_ = this; |
| } |
|
oshima
2014/01/09 19:13:45
can you move them to separate drag_details.cc ?
varkha
2014/01/10 01:34:50
I assume this comment is about constructor and des
|
| void DragWindowResizer::UpdateDragWindow(const gfx::Rect& bounds, |
| bool in_original_root) { |
| - if (details_.window_component != HTCAPTION || !ShouldAllowMouseWarp()) |
| + if (details().window_component != HTCAPTION || !ShouldAllowMouseWarp()) |
| return; |
| // It's available. Show a phantom window on the display if needed. |
| @@ -232,7 +217,7 @@ void DragWindowResizer::UpdateDragWindow(const gfx::Rect& bounds, |
| } |
| bool DragWindowResizer::ShouldAllowMouseWarp() { |
| - return (details_.window_component == HTCAPTION) && |
| + return (details().window_component == HTCAPTION) && |
| !views::corewm::GetTransientParent(GetTarget()) && |
| (GetTarget()->type() == ui::wm::WINDOW_TYPE_NORMAL || |
| GetTarget()->type() == ui::wm::WINDOW_TYPE_PANEL); |
| @@ -245,7 +230,7 @@ TrayUser* DragWindowResizer::GetTrayUserItemAtPoint( |
| return NULL; |
| // Check that this is a drag move operation from a suitable window. |
| - if (details_.window_component != HTCAPTION || |
| + if (details().window_component != HTCAPTION || |
| views::corewm::GetTransientParent(GetTarget()) || |
| (GetTarget()->type() != ui::wm::WINDOW_TYPE_NORMAL && |
| GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL && |
| @@ -254,7 +239,7 @@ TrayUser* DragWindowResizer::GetTrayUserItemAtPoint( |
| // We only allow to drag the window onto a tray of it's own RootWindow. |
| SystemTray* tray = internal::GetRootWindowController( |
| - details_.window->GetRootWindow())->GetSystemTray(); |
| + GetTarget()->GetRootWindow())->GetSystemTray(); |
| // Again - unit tests might not have a tray. |
| if (!tray) |
| @@ -285,8 +270,8 @@ bool DragWindowResizer::TryDraggingToNewUser() { |
| // it's thing and return the transparency to its original value. |
| int old_opacity = GetTarget()->layer()->opacity(); |
| GetTarget()->layer()->SetOpacity(0); |
| - GetTarget()->SetBounds(details_.initial_bounds_in_parent); |
| - if (!tray_user->TransferWindowToUser(details_.window)) { |
| + GetTarget()->SetBounds(details().initial_bounds_in_parent); |
| + if (!tray_user->TransferWindowToUser(GetTarget())) { |
| GetTarget()->layer()->SetOpacity(old_opacity); |
| return false; |
| } |