| 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/drag_drop/drag_drop_controller.h" |    5 #include "ash/drag_drop/drag_drop_controller.h" | 
|    6  |    6  | 
|    7 #include <utility> |    7 #include <utility> | 
|    8  |    8  | 
|    9 #include "ash/aura/wm_window_aura.h" |  | 
|   10 #include "ash/common/drag_drop/drag_image_view.h" |    9 #include "ash/common/drag_drop/drag_image_view.h" | 
|   11 #include "ash/common/wm_shell.h" |   10 #include "ash/common/wm_shell.h" | 
 |   11 #include "ash/common/wm_window.h" | 
|   12 #include "ash/drag_drop/drag_drop_tracker.h" |   12 #include "ash/drag_drop/drag_drop_tracker.h" | 
|   13 #include "ash/shell.h" |   13 #include "ash/shell.h" | 
|   14 #include "base/bind.h" |   14 #include "base/bind.h" | 
|   15 #include "base/message_loop/message_loop.h" |   15 #include "base/message_loop/message_loop.h" | 
|   16 #include "base/metrics/histogram_macros.h" |   16 #include "base/metrics/histogram_macros.h" | 
|   17 #include "base/run_loop.h" |   17 #include "base/run_loop.h" | 
|   18 #include "base/threading/thread_task_runner_handle.h" |   18 #include "base/threading/thread_task_runner_handle.h" | 
|   19 #include "ui/aura/client/capture_client.h" |   19 #include "ui/aura/client/capture_client.h" | 
|   20 #include "ui/aura/client/drag_drop_delegate.h" |   20 #include "ui/aura/client/drag_drop_delegate.h" | 
|   21 #include "ui/aura/env.h" |   21 #include "ui/aura/env.h" | 
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  196   float drag_image_scale = 1; |  196   float drag_image_scale = 1; | 
|  197   int drag_image_vertical_offset = 0; |  197   int drag_image_vertical_offset = 0; | 
|  198   if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { |  198   if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { | 
|  199     drag_image_scale = kTouchDragImageScale; |  199     drag_image_scale = kTouchDragImageScale; | 
|  200     drag_image_vertical_offset = kTouchDragImageVerticalOffset; |  200     drag_image_vertical_offset = kTouchDragImageVerticalOffset; | 
|  201   } |  201   } | 
|  202   gfx::Point start_location = screen_location; |  202   gfx::Point start_location = screen_location; | 
|  203   drag_image_final_bounds_for_cancel_animation_ = |  203   drag_image_final_bounds_for_cancel_animation_ = | 
|  204       gfx::Rect(start_location - provider->GetDragImageOffset(), |  204       gfx::Rect(start_location - provider->GetDragImageOffset(), | 
|  205                 provider->GetDragImage().size()); |  205                 provider->GetDragImage().size()); | 
|  206   drag_image_.reset(new DragImageView( |  206   drag_image_.reset( | 
|  207       WmWindowAura::Get(source_window->GetRootWindow()), source)); |  207       new DragImageView(WmWindow::Get(source_window->GetRootWindow()), source)); | 
|  208   drag_image_->SetImage(provider->GetDragImage()); |  208   drag_image_->SetImage(provider->GetDragImage()); | 
|  209   drag_image_offset_ = provider->GetDragImageOffset(); |  209   drag_image_offset_ = provider->GetDragImageOffset(); | 
|  210   gfx::Rect drag_image_bounds(start_location, drag_image_->GetPreferredSize()); |  210   gfx::Rect drag_image_bounds(start_location, drag_image_->GetPreferredSize()); | 
|  211   drag_image_bounds = AdjustDragImageBoundsForScaleAndOffset( |  211   drag_image_bounds = AdjustDragImageBoundsForScaleAndOffset( | 
|  212       drag_image_bounds, drag_image_vertical_offset, drag_image_scale, |  212       drag_image_bounds, drag_image_vertical_offset, drag_image_scale, | 
|  213       &drag_image_offset_); |  213       &drag_image_offset_); | 
|  214   drag_image_->SetBoundsInScreen(drag_image_bounds); |  214   drag_image_->SetBoundsInScreen(drag_image_bounds); | 
|  215   drag_image_->SetWidgetVisible(true); |  215   drag_image_->SetWidgetVisible(true); | 
|  216   if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { |  216   if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { | 
|  217     drag_image_->SetTouchDragOperationHintPosition( |  217     drag_image_->SetTouchDragOperationHintPosition( | 
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  574   if (drag_window_) |  574   if (drag_window_) | 
|  575     drag_window_->RemoveObserver(this); |  575     drag_window_->RemoveObserver(this); | 
|  576   drag_window_ = NULL; |  576   drag_window_ = NULL; | 
|  577   drag_data_ = NULL; |  577   drag_data_ = NULL; | 
|  578   // Cleanup can be called again while deleting DragDropTracker, so delete |  578   // Cleanup can be called again while deleting DragDropTracker, so delete | 
|  579   // the pointer with a local variable to avoid double free. |  579   // the pointer with a local variable to avoid double free. | 
|  580   std::unique_ptr<ash::DragDropTracker> holder = std::move(drag_drop_tracker_); |  580   std::unique_ptr<ash::DragDropTracker> holder = std::move(drag_drop_tracker_); | 
|  581 } |  581 } | 
|  582  |  582  | 
|  583 }  // namespace ash |  583 }  // namespace ash | 
| OLD | NEW |