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 "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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 return; | 170 return; |
171 } | 171 } |
172 | 172 |
173 // Start a background thread to do the drag-and-drop. | 173 // Start a background thread to do the drag-and-drop. |
174 DCHECK(!drag_drop_thread_.get()); | 174 DCHECK(!drag_drop_thread_.get()); |
175 drag_drop_thread_.reset(new DragDropThread(this)); | 175 drag_drop_thread_.reset(new DragDropThread(this)); |
176 base::Thread::Options options; | 176 base::Thread::Options options; |
177 options.message_loop_type = MessageLoop::TYPE_UI; | 177 options.message_loop_type = MessageLoop::TYPE_UI; |
178 if (drag_drop_thread_->StartWithOptions(options)) { | 178 if (drag_drop_thread_->StartWithOptions(options)) { |
179 gfx::Display display = | 179 gfx::Display display = |
180 gfx::Screen::GetDisplayNearestWindow(web_contents_->GetNativeView()); | 180 gfx::Screen::GetNativeScreen()->GetDisplayNearestWindow( |
| 181 web_contents_->GetNativeView()); |
181 ui::ScaleFactor scale_factor = ui::GetScaleFactorFromScale( | 182 ui::ScaleFactor scale_factor = ui::GetScaleFactorFromScale( |
182 display.device_scale_factor()); | 183 display.device_scale_factor()); |
183 drag_drop_thread_->message_loop()->PostTask( | 184 drag_drop_thread_->message_loop()->PostTask( |
184 FROM_HERE, | 185 FROM_HERE, |
185 base::Bind(&WebContentsDragWin::StartBackgroundDragging, this, | 186 base::Bind(&WebContentsDragWin::StartBackgroundDragging, this, |
186 drop_data, ops, page_url, page_encoding, | 187 drop_data, ops, page_url, page_encoding, |
187 image.GetRepresentation(scale_factor).sk_bitmap(), | 188 image.GetRepresentation(scale_factor).sk_bitmap(), |
188 image_offset)); | 189 image_offset)); |
189 } | 190 } |
190 | 191 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 void WebContentsDragWin::OnDataObjectDisposed() { | 416 void WebContentsDragWin::OnDataObjectDisposed() { |
416 DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId()); | 417 DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId()); |
417 | 418 |
418 // The drag-and-drop thread is only closed after OLE is done with | 419 // The drag-and-drop thread is only closed after OLE is done with |
419 // DataObjectImpl. | 420 // DataObjectImpl. |
420 BrowserThread::PostTask( | 421 BrowserThread::PostTask( |
421 BrowserThread::UI, | 422 BrowserThread::UI, |
422 FROM_HERE, | 423 FROM_HERE, |
423 base::Bind(&WebContentsDragWin::CloseThread, this)); | 424 base::Bind(&WebContentsDragWin::CloseThread, this)); |
424 } | 425 } |
OLD | NEW |