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 // Download utility implementation | 5 // Download utility implementation |
6 | 6 |
7 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 7 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
8 | 8 |
9 #include "chrome/browser/download/download_util.h" | 9 #include "chrome/browser/download/download_util.h" |
10 | 10 |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 download->GetFileNameToReportUser().LossyDisplayName()); | 386 download->GetFileNameToReportUser().LossyDisplayName()); |
387 } | 387 } |
388 | 388 |
389 #if !defined(TOOLKIT_GTK) | 389 #if !defined(TOOLKIT_GTK) |
390 #if defined(USE_AURA) | 390 #if defined(USE_AURA) |
391 aura::RootWindow* root_window = view->GetRootWindow(); | 391 aura::RootWindow* root_window = view->GetRootWindow(); |
392 if (!root_window || !aura::client::GetDragDropClient(root_window)) | 392 if (!root_window || !aura::client::GetDragDropClient(root_window)) |
393 return; | 393 return; |
394 | 394 |
395 gfx::Point location = gfx::Screen::GetScreenFor(view)->GetCursorScreenPoint(); | 395 gfx::Point location = gfx::Screen::GetScreenFor(view)->GetCursorScreenPoint(); |
| 396 // TODO(varunjain): Properly determine and send DRAG_EVENT_SOURCE below. |
396 aura::client::GetDragDropClient(root_window)->StartDragAndDrop( | 397 aura::client::GetDragDropClient(root_window)->StartDragAndDrop( |
397 data, | 398 data, |
398 root_window, | 399 root_window, |
| 400 view, |
399 location, | 401 location, |
400 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK); | 402 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK, |
| 403 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); |
401 #else // We are on WIN without AURA | 404 #else // We are on WIN without AURA |
402 // We cannot use Widget::RunShellDrag on WIN since the |view| is backed by a | 405 // We cannot use Widget::RunShellDrag on WIN since the |view| is backed by a |
403 // TabContentsViewWin, not a NativeWidgetWin. | 406 // TabContentsViewWin, not a NativeWidgetWin. |
404 scoped_refptr<ui::DragSource> drag_source(new ui::DragSource); | 407 scoped_refptr<ui::DragSource> drag_source(new ui::DragSource); |
405 // Run the drag and drop loop | 408 // Run the drag and drop loop |
406 DWORD effects; | 409 DWORD effects; |
407 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), | 410 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), |
408 drag_source.get(), DROPEFFECT_COPY | DROPEFFECT_LINK, &effects); | 411 drag_source.get(), DROPEFFECT_COPY | DROPEFFECT_LINK, &effects); |
409 #endif | 412 #endif |
410 | 413 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 ShowInShelfData* data = | 520 ShowInShelfData* data = |
518 static_cast<ShowInShelfData*>(item->GetUserData(kShowInShelfKey)); | 521 static_cast<ShowInShelfData*>(item->GetUserData(kShowInShelfKey)); |
519 return !data || data->should_show(); | 522 return !data || data->should_show(); |
520 } | 523 } |
521 | 524 |
522 void SetShouldShowInShelf(content::DownloadItem* item, bool should_show) { | 525 void SetShouldShowInShelf(content::DownloadItem* item, bool should_show) { |
523 item->SetUserData(kShowInShelfKey, new ShowInShelfData(should_show)); | 526 item->SetUserData(kShowInShelfKey, new ShowInShelfData(should_show)); |
524 } | 527 } |
525 | 528 |
526 } // namespace download_util | 529 } // namespace download_util |
OLD | NEW |