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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 data.SetURL(net::FilePathToFileURL(full_path), | 367 data.SetURL(net::FilePathToFileURL(full_path), |
368 download->GetFileNameToReportUser().LossyDisplayName()); | 368 download->GetFileNameToReportUser().LossyDisplayName()); |
369 } | 369 } |
370 | 370 |
371 #if !defined(TOOLKIT_GTK) | 371 #if !defined(TOOLKIT_GTK) |
372 #if defined(USE_AURA) | 372 #if defined(USE_AURA) |
373 aura::RootWindow* root_window = view->GetRootWindow(); | 373 aura::RootWindow* root_window = view->GetRootWindow(); |
374 if (!root_window || !aura::client::GetDragDropClient(root_window)) | 374 if (!root_window || !aura::client::GetDragDropClient(root_window)) |
375 return; | 375 return; |
376 | 376 |
377 gfx::Point location = gfx::Screen::GetCursorScreenPoint(); | 377 gfx::Point location = gfx::Screen::GetScreenFor(view)->GetCursorScreenPoint(); |
378 aura::client::GetDragDropClient(root_window)->StartDragAndDrop( | 378 aura::client::GetDragDropClient(root_window)->StartDragAndDrop( |
379 data, | 379 data, |
380 root_window, | 380 root_window, |
381 location, | 381 location, |
382 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK); | 382 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK); |
383 #else // We are on WIN without AURA | 383 #else // We are on WIN without AURA |
384 // We cannot use Widget::RunShellDrag on WIN since the |view| is backed by a | 384 // We cannot use Widget::RunShellDrag on WIN since the |view| is backed by a |
385 // TabContentsViewWin, not a NativeWidgetWin. | 385 // TabContentsViewWin, not a NativeWidgetWin. |
386 scoped_refptr<ui::DragSource> drag_source(new ui::DragSource); | 386 scoped_refptr<ui::DragSource> drag_source(new ui::DragSource); |
387 // Run the drag and drop loop | 387 // Run the drag and drop loop |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 ShowInShelfData* data = | 499 ShowInShelfData* data = |
500 static_cast<ShowInShelfData*>(item->GetUserData(kShowInShelfKey)); | 500 static_cast<ShowInShelfData*>(item->GetUserData(kShowInShelfKey)); |
501 return !data || data->should_show(); | 501 return !data || data->should_show(); |
502 } | 502 } |
503 | 503 |
504 void SetShouldShowInShelf(content::DownloadItem* item, bool should_show) { | 504 void SetShouldShowInShelf(content::DownloadItem* item, bool should_show) { |
505 item->SetUserData(kShowInShelfKey, new ShowInShelfData(should_show)); | 505 item->SetUserData(kShowInShelfKey, new ShowInShelfData(should_show)); |
506 } | 506 } |
507 | 507 |
508 } // namespace download_util | 508 } // namespace download_util |
OLD | NEW |