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 "chrome/browser/ui/views/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windowsx.h> | 8 #include <windowsx.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 void TabStrip::OnDragEntered(const DropTargetEvent& event) { | 1403 void TabStrip::OnDragEntered(const DropTargetEvent& event) { |
1404 // Force animations to stop, otherwise it makes the index calculation tricky. | 1404 // Force animations to stop, otherwise it makes the index calculation tricky. |
1405 StopAnimating(true); | 1405 StopAnimating(true); |
1406 | 1406 |
1407 UpdateDropIndex(event); | 1407 UpdateDropIndex(event); |
1408 | 1408 |
1409 GURL url; | 1409 GURL url; |
1410 base::string16 title; | 1410 base::string16 title; |
1411 | 1411 |
1412 // Check whether the event data includes supported drop data. | 1412 // Check whether the event data includes supported drop data. |
1413 if (event.data().GetURLAndTitle(&url, &title) && url.is_valid()) { | 1413 if (event.data().GetURLAndTitle( |
| 1414 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title) && |
| 1415 url.is_valid()) { |
1414 drop_info_->url = url; | 1416 drop_info_->url = url; |
1415 | 1417 |
1416 // For file:// URLs, kick off a MIME type request in case they're dropped. | 1418 // For file:// URLs, kick off a MIME type request in case they're dropped. |
1417 if (url.SchemeIsFile()) | 1419 if (url.SchemeIsFile()) |
1418 controller()->CheckFileSupported(url); | 1420 controller()->CheckFileSupported(url); |
1419 } | 1421 } |
1420 } | 1422 } |
1421 | 1423 |
1422 int TabStrip::OnDragUpdated(const DropTargetEvent& event) { | 1424 int TabStrip::OnDragUpdated(const DropTargetEvent& event) { |
1423 // Update the drop index even if the file is unsupported, to allow | 1425 // Update the drop index even if the file is unsupported, to allow |
(...skipping 19 matching lines...) Expand all Loading... |
1443 const bool file_supported = drop_info_->file_supported; | 1445 const bool file_supported = drop_info_->file_supported; |
1444 | 1446 |
1445 // Hide the drop indicator. | 1447 // Hide the drop indicator. |
1446 SetDropIndex(-1, false); | 1448 SetDropIndex(-1, false); |
1447 | 1449 |
1448 // Do nothing if the file was unsupported or the URL is invalid. The URL may | 1450 // Do nothing if the file was unsupported or the URL is invalid. The URL may |
1449 // have been changed after |drop_info_| was created. | 1451 // have been changed after |drop_info_| was created. |
1450 GURL url; | 1452 GURL url; |
1451 base::string16 title; | 1453 base::string16 title; |
1452 if (!file_supported || | 1454 if (!file_supported || |
1453 !event.data().GetURLAndTitle(&url, &title) || !url.is_valid()) | 1455 !event.data().GetURLAndTitle( |
| 1456 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title) || |
| 1457 !url.is_valid()) |
1454 return ui::DragDropTypes::DRAG_NONE; | 1458 return ui::DragDropTypes::DRAG_NONE; |
1455 | 1459 |
1456 controller()->PerformDrop(drop_before, drop_index, url); | 1460 controller()->PerformDrop(drop_before, drop_index, url); |
1457 | 1461 |
1458 return GetDropEffect(event); | 1462 return GetDropEffect(event); |
1459 } | 1463 } |
1460 | 1464 |
1461 void TabStrip::GetAccessibleState(ui::AccessibleViewState* state) { | 1465 void TabStrip::GetAccessibleState(ui::AccessibleViewState* state) { |
1462 state->role = ui::AccessibilityTypes::ROLE_PAGETABLIST; | 1466 state->role = ui::AccessibilityTypes::ROLE_PAGETABLIST; |
1463 } | 1467 } |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2771 #if defined(USE_AURA) | 2775 #if defined(USE_AURA) |
2772 return chrome::GetHostDesktopTypeForNativeView( | 2776 return chrome::GetHostDesktopTypeForNativeView( |
2773 GetWidget()->GetNativeView()) == chrome::HOST_DESKTOP_TYPE_ASH; | 2777 GetWidget()->GetNativeView()) == chrome::HOST_DESKTOP_TYPE_ASH; |
2774 #else | 2778 #else |
2775 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) | 2779 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) |
2776 return false; | 2780 return false; |
2777 #endif | 2781 #endif |
2778 | 2782 |
2779 return true; | 2783 return true; |
2780 } | 2784 } |
OLD | NEW |