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

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

Issue 14297013: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ash/display/output_configurator_animation.cc ('k') | ash/focus_cycler_unittest.cc » ('j') | no next file with comments »
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 "ash/drag_drop/drag_drop_tracker.h" 7 #include "ash/drag_drop/drag_drop_tracker.h"
8 #include "ash/drag_drop/drag_image_view.h" 8 #include "ash/drag_drop/drag_image_view.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/coordinate_conversion.h" 10 #include "ash/wm/coordinate_conversion.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 ALLOW_THIS_IN_INITIALIZER_LIST( 148 ALLOW_THIS_IN_INITIALIZER_LIST(
149 drag_drop_window_delegate_(new DragDropTrackerDelegate(this))), 149 drag_drop_window_delegate_(new DragDropTrackerDelegate(this))),
150 current_drag_event_source_(ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE), 150 current_drag_event_source_(ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE),
151 weak_factory_(this) { 151 weak_factory_(this) {
152 Shell::GetInstance()->AddPreTargetHandler(this); 152 Shell::GetInstance()->AddPreTargetHandler(this);
153 } 153 }
154 154
155 DragDropController::~DragDropController() { 155 DragDropController::~DragDropController() {
156 Shell::GetInstance()->RemovePreTargetHandler(this); 156 Shell::GetInstance()->RemovePreTargetHandler(this);
157 Cleanup(); 157 Cleanup();
158 if (cancel_animation_.get()) 158 if (cancel_animation_)
159 cancel_animation_->End(); 159 cancel_animation_->End();
160 if (drag_image_.get()) 160 if (drag_image_)
161 drag_image_.reset(); 161 drag_image_.reset();
162 } 162 }
163 163
164 int DragDropController::StartDragAndDrop( 164 int DragDropController::StartDragAndDrop(
165 const ui::OSExchangeData& data, 165 const ui::OSExchangeData& data,
166 aura::RootWindow* root_window, 166 aura::RootWindow* root_window,
167 aura::Window* source_window, 167 aura::Window* source_window,
168 const gfx::Point& root_location, 168 const gfx::Point& root_location,
169 int operation, 169 int operation,
170 ui::DragDropTypes::DragEventSource source) { 170 ui::DragDropTypes::DragEventSource source) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 drag_image_offset_ = provider->GetDragImageOffset(); 217 drag_image_offset_ = provider->GetDragImageOffset();
218 gfx::Rect drag_image_bounds(start_location, drag_image_->GetPreferredSize()); 218 gfx::Rect drag_image_bounds(start_location, drag_image_->GetPreferredSize());
219 drag_image_bounds = AdjustDragImageBoundsForScaleAndOffset(drag_image_bounds, 219 drag_image_bounds = AdjustDragImageBoundsForScaleAndOffset(drag_image_bounds,
220 drag_image_vertical_offset, drag_image_scale, &drag_image_offset_); 220 drag_image_vertical_offset, drag_image_scale, &drag_image_offset_);
221 drag_image_->SetBoundsInScreen(drag_image_bounds); 221 drag_image_->SetBoundsInScreen(drag_image_bounds);
222 drag_image_->SetWidgetVisible(true); 222 drag_image_->SetWidgetVisible(true);
223 223
224 drag_window_ = NULL; 224 drag_window_ = NULL;
225 225
226 // Ends cancel animation if it's in progress. 226 // Ends cancel animation if it's in progress.
227 if (cancel_animation_.get()) 227 if (cancel_animation_)
228 cancel_animation_->End(); 228 cancel_animation_->End();
229 229
230 #if !defined(OS_MACOSX) 230 #if !defined(OS_MACOSX)
231 if (should_block_during_drag_drop_) { 231 if (should_block_during_drag_drop_) {
232 base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher()); 232 base::RunLoop run_loop(aura::Env::GetInstance()->GetDispatcher());
233 quit_closure_ = run_loop.QuitClosure(); 233 quit_closure_ = run_loop.QuitClosure();
234 MessageLoopForUI* loop = MessageLoopForUI::current(); 234 MessageLoopForUI* loop = MessageLoopForUI::current();
235 MessageLoop::ScopedNestableTaskAllower allow_nested(loop); 235 MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
236 run_loop.Run(); 236 run_loop.Run();
237 } 237 }
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 //////////////////////////////////////////////////////////////////////////////// 480 ////////////////////////////////////////////////////////////////////////////////
481 // DragDropController, private: 481 // DragDropController, private:
482 482
483 void DragDropController::AnimationEnded(const ui::Animation* animation) { 483 void DragDropController::AnimationEnded(const ui::Animation* animation) {
484 cancel_animation_.reset(); 484 cancel_animation_.reset();
485 485
486 // By the time we finish animation, another drag/drop session may have 486 // By the time we finish animation, another drag/drop session may have
487 // started. We do not want to destroy the drag image in that case. 487 // started. We do not want to destroy the drag image in that case.
488 if (!IsDragDropInProgress()) 488 if (!IsDragDropInProgress())
489 drag_image_.reset(); 489 drag_image_.reset();
490 if (pending_long_tap_.get()) { 490 if (pending_long_tap_) {
491 // If not in a nested message loop, we can forward the long tap right now. 491 // If not in a nested message loop, we can forward the long tap right now.
492 if (!should_block_during_drag_drop_) 492 if (!should_block_during_drag_drop_)
493 ForwardPendingLongTap(); 493 ForwardPendingLongTap();
494 else { 494 else {
495 // See comment about this in OnGestureEvent(). 495 // See comment about this in OnGestureEvent().
496 MessageLoopForUI::current()->PostTask( 496 MessageLoopForUI::current()->PostTask(
497 FROM_HERE, base::Bind(&DragDropController::ForwardPendingLongTap, 497 FROM_HERE, base::Bind(&DragDropController::ForwardPendingLongTap,
498 weak_factory_.GetWeakPtr())); 498 weak_factory_.GetWeakPtr()));
499 } 499 }
500 } 500 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 drag_window_->RemoveObserver(this); 555 drag_window_->RemoveObserver(this);
556 drag_window_ = NULL; 556 drag_window_ = NULL;
557 drag_data_ = NULL; 557 drag_data_ = NULL;
558 // Cleanup can be called again while deleting DragDropTracker, so use Pass 558 // Cleanup can be called again while deleting DragDropTracker, so use Pass
559 // instead of reset to avoid double free. 559 // instead of reset to avoid double free.
560 drag_drop_tracker_.Pass(); 560 drag_drop_tracker_.Pass();
561 } 561 }
562 562
563 } // namespace internal 563 } // namespace internal
564 } // namespace ash 564 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/output_configurator_animation.cc ('k') | ash/focus_cycler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698