Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: ash/drag_drop/drag_drop_controller.cc

Issue 2828543003: chromeos: converts DragImageViewTest to AshTestBase (Closed)
Patch Set: cleanup Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/drag_drop/drag_image_view.h » ('j') | ash/test/ash_test_base.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/drag_drop/drag_drop_tracker.h" 9 #include "ash/drag_drop/drag_drop_tracker.h"
10 #include "ash/drag_drop/drag_image_view.h" 10 #include "ash/drag_drop/drag_image_view.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/shell_port.h" 12 #include "ash/shell_port.h"
13 #include "ash/wm_window.h" 13 #include "ash/wm_window.h"
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/memory/ptr_util.h"
15 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
16 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
17 #include "base/run_loop.h" 18 #include "base/run_loop.h"
18 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
19 #include "ui/aura/client/capture_client.h" 20 #include "ui/aura/client/capture_client.h"
20 #include "ui/aura/client/drag_drop_delegate.h" 21 #include "ui/aura/client/drag_drop_delegate.h"
21 #include "ui/aura/env.h" 22 #include "ui/aura/env.h"
22 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
23 #include "ui/aura/window_delegate.h" 24 #include "ui/aura/window_delegate.h"
24 #include "ui/aura/window_event_dispatcher.h" 25 #include "ui/aura/window_event_dispatcher.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 float drag_image_scale = 1; 197 float drag_image_scale = 1;
197 int drag_image_vertical_offset = 0; 198 int drag_image_vertical_offset = 0;
198 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { 199 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) {
199 drag_image_scale = kTouchDragImageScale; 200 drag_image_scale = kTouchDragImageScale;
200 drag_image_vertical_offset = kTouchDragImageVerticalOffset; 201 drag_image_vertical_offset = kTouchDragImageVerticalOffset;
201 } 202 }
202 gfx::Point start_location = screen_location; 203 gfx::Point start_location = screen_location;
203 drag_image_final_bounds_for_cancel_animation_ = 204 drag_image_final_bounds_for_cancel_animation_ =
204 gfx::Rect(start_location - provider->GetDragImageOffset(), 205 gfx::Rect(start_location - provider->GetDragImageOffset(),
205 provider->GetDragImage().size()); 206 provider->GetDragImage().size());
206 drag_image_.reset( 207 drag_image_ =
207 new DragImageView(WmWindow::Get(source_window->GetRootWindow()), source)); 208 base::MakeUnique<DragImageView>(source_window->GetRootWindow(), source);
208 drag_image_->SetImage(provider->GetDragImage()); 209 drag_image_->SetImage(provider->GetDragImage());
209 drag_image_offset_ = provider->GetDragImageOffset(); 210 drag_image_offset_ = provider->GetDragImageOffset();
210 gfx::Rect drag_image_bounds(start_location, drag_image_->GetPreferredSize()); 211 gfx::Rect drag_image_bounds(start_location, drag_image_->GetPreferredSize());
211 drag_image_bounds = AdjustDragImageBoundsForScaleAndOffset( 212 drag_image_bounds = AdjustDragImageBoundsForScaleAndOffset(
212 drag_image_bounds, drag_image_vertical_offset, drag_image_scale, 213 drag_image_bounds, drag_image_vertical_offset, drag_image_scale,
213 &drag_image_offset_); 214 &drag_image_offset_);
214 drag_image_->SetBoundsInScreen(drag_image_bounds); 215 drag_image_->SetBoundsInScreen(drag_image_bounds);
215 drag_image_->SetWidgetVisible(true); 216 drag_image_->SetWidgetVisible(true);
216 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { 217 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) {
217 drag_image_->SetTouchDragOperationHintPosition( 218 drag_image_->SetTouchDragOperationHintPosition(
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 if (drag_window_) 575 if (drag_window_)
575 drag_window_->RemoveObserver(this); 576 drag_window_->RemoveObserver(this);
576 drag_window_ = NULL; 577 drag_window_ = NULL;
577 drag_data_ = NULL; 578 drag_data_ = NULL;
578 // Cleanup can be called again while deleting DragDropTracker, so delete 579 // Cleanup can be called again while deleting DragDropTracker, so delete
579 // the pointer with a local variable to avoid double free. 580 // the pointer with a local variable to avoid double free.
580 std::unique_ptr<ash::DragDropTracker> holder = std::move(drag_drop_tracker_); 581 std::unique_ptr<ash::DragDropTracker> holder = std::move(drag_drop_tracker_);
581 } 582 }
582 583
583 } // namespace ash 584 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/drag_drop/drag_image_view.h » ('j') | ash/test/ash_test_base.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698