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

Side by Side Diff: content/browser/web_contents/web_contents_drag_win.cc

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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
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 "content/browser/web_contents/web_contents_drag_win.h" 5 #include "content/browser/web_contents/web_contents_drag_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (DoDragging(drop_data, ops, page_url, page_encoding, 171 if (DoDragging(drop_data, ops, page_url, page_encoding,
172 image, image_offset)) 172 image, image_offset))
173 EndDragging(); 173 EndDragging();
174 return; 174 return;
175 } 175 }
176 176
177 // Start a background thread to do the drag-and-drop. 177 // Start a background thread to do the drag-and-drop.
178 DCHECK(!drag_drop_thread_.get()); 178 DCHECK(!drag_drop_thread_.get());
179 drag_drop_thread_.reset(new DragDropThread(this)); 179 drag_drop_thread_.reset(new DragDropThread(this));
180 base::Thread::Options options; 180 base::Thread::Options options;
181 options.message_loop_type = MessageLoop::TYPE_UI; 181 options.message_loop_type = base::MessageLoop::TYPE_UI;
182 if (drag_drop_thread_->StartWithOptions(options)) { 182 if (drag_drop_thread_->StartWithOptions(options)) {
183 drag_drop_thread_->message_loop()->PostTask( 183 drag_drop_thread_->message_loop()->PostTask(
184 FROM_HERE, 184 FROM_HERE,
185 base::Bind(&WebContentsDragWin::StartBackgroundDragging, this, 185 base::Bind(&WebContentsDragWin::StartBackgroundDragging, this,
186 drop_data, ops, page_url, page_encoding, 186 drop_data, ops, page_url, page_encoding,
187 image, image_offset)); 187 image, image_offset));
188 } 188 }
189 189
190 EnableBackgroundDraggingSupport(drag_drop_thread_->thread_id()); 190 EnableBackgroundDraggingSupport(drag_drop_thread_->thread_id());
191 } 191 }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // updates while in the system DoDragDrop loop. 357 // updates while in the system DoDragDrop loop.
358 DWORD effect = DROPEFFECT_NONE; 358 DWORD effect = DROPEFFECT_NONE;
359 if (run_do_drag_drop) { 359 if (run_do_drag_drop) {
360 // Keep a reference count such that |drag_source_| will not get deleted 360 // Keep a reference count such that |drag_source_| will not get deleted
361 // if the contents view window is gone in the nested message loop invoked 361 // if the contents view window is gone in the nested message loop invoked
362 // from DoDragDrop. 362 // from DoDragDrop.
363 scoped_refptr<WebDragSource> retain_source(drag_source_); 363 scoped_refptr<WebDragSource> retain_source(drag_source_);
364 retain_source->set_data(&data); 364 retain_source->set_data(&data);
365 data.SetInDragLoop(true); 365 data.SetInDragLoop(true);
366 366
367 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); 367 base::MessageLoop::ScopedNestableTaskAllower allow(
368 base::MessageLoop::current());
368 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), 369 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data),
369 drag_source_, 370 drag_source_,
370 WebDragOpMaskToWinDragOpMask(ops), 371 WebDragOpMaskToWinDragOpMask(ops),
371 &effect); 372 &effect);
372 retain_source->set_data(NULL); 373 retain_source->set_data(NULL);
373 } 374 }
374 375
375 // Bail out immediately if the contents view window is gone. 376 // Bail out immediately if the contents view window is gone.
376 if (!IsWindow(native_window)) 377 if (!IsWindow(native_window))
377 return false; 378 return false;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 FROM_HERE, 435 FROM_HERE,
435 base::Bind(&WebContentsDragWin::CloseThread, this)); 436 base::Bind(&WebContentsDragWin::CloseThread, this));
436 } 437 }
437 438
438 // static 439 // static
439 void WebContentsDragWin::DisableDragDropForTesting() { 440 void WebContentsDragWin::DisableDragDropForTesting() {
440 run_do_drag_drop = false; 441 run_do_drag_drop = false;
441 } 442 }
442 443
443 } // namespace content 444 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698