| 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 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 void TabStrip::OnDragEntered(const DropTargetEvent& event) { | 1603 void TabStrip::OnDragEntered(const DropTargetEvent& event) { |
| 1604 // Force animations to stop, otherwise it makes the index calculation tricky. | 1604 // Force animations to stop, otherwise it makes the index calculation tricky. |
| 1605 StopAnimating(true); | 1605 StopAnimating(true); |
| 1606 | 1606 |
| 1607 UpdateDropIndex(event); | 1607 UpdateDropIndex(event); |
| 1608 | 1608 |
| 1609 GURL url; | 1609 GURL url; |
| 1610 base::string16 title; | 1610 base::string16 title; |
| 1611 | 1611 |
| 1612 // Check whether the event data includes supported drop data. | 1612 // Check whether the event data includes supported drop data. |
| 1613 if (event.data().GetURLAndTitle( | 1613 if (event.data().GetURLAndTitle(ui::OSExchangeData::CONVERT_FILENAMES, |
| 1614 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title) && | 1614 ui::OSExchangeData::PARSE_TEXT_AS_URL, &url, |
| 1615 &title) && |
| 1615 url.is_valid()) { | 1616 url.is_valid()) { |
| 1616 drop_info_->url = url; | 1617 drop_info_->url = url; |
| 1617 | 1618 |
| 1618 // For file:// URLs, kick off a MIME type request in case they're dropped. | 1619 // For file:// URLs, kick off a MIME type request in case they're dropped. |
| 1619 if (url.SchemeIsFile()) | 1620 if (url.SchemeIsFile()) |
| 1620 controller_->CheckFileSupported(url); | 1621 controller_->CheckFileSupported(url); |
| 1621 } | 1622 } |
| 1622 } | 1623 } |
| 1623 | 1624 |
| 1624 int TabStrip::OnDragUpdated(const DropTargetEvent& event) { | 1625 int TabStrip::OnDragUpdated(const DropTargetEvent& event) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1645 const bool file_supported = drop_info_->file_supported; | 1646 const bool file_supported = drop_info_->file_supported; |
| 1646 | 1647 |
| 1647 // Hide the drop indicator. | 1648 // Hide the drop indicator. |
| 1648 SetDropIndex(-1, false); | 1649 SetDropIndex(-1, false); |
| 1649 | 1650 |
| 1650 // Do nothing if the file was unsupported or the URL is invalid. The URL may | 1651 // Do nothing if the file was unsupported or the URL is invalid. The URL may |
| 1651 // have been changed after |drop_info_| was created. | 1652 // have been changed after |drop_info_| was created. |
| 1652 GURL url; | 1653 GURL url; |
| 1653 base::string16 title; | 1654 base::string16 title; |
| 1654 if (!file_supported || | 1655 if (!file_supported || |
| 1655 !event.data().GetURLAndTitle( | 1656 !event.data().GetURLAndTitle(ui::OSExchangeData::CONVERT_FILENAMES, |
| 1656 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title) || | 1657 ui::OSExchangeData::PARSE_TEXT_AS_URL, &url, |
| 1658 &title) || |
| 1657 !url.is_valid()) | 1659 !url.is_valid()) |
| 1658 return ui::DragDropTypes::DRAG_NONE; | 1660 return ui::DragDropTypes::DRAG_NONE; |
| 1659 | 1661 |
| 1660 controller_->PerformDrop(drop_before, drop_index, url); | 1662 controller_->PerformDrop(drop_before, drop_index, url); |
| 1661 | 1663 |
| 1662 return GetDropEffect(event); | 1664 return GetDropEffect(event); |
| 1663 } | 1665 } |
| 1664 | 1666 |
| 1665 void TabStrip::GetAccessibleState(ui::AXViewState* state) { | 1667 void TabStrip::GetAccessibleState(ui::AXViewState* state) { |
| 1666 state->role = ui::AX_ROLE_TAB_LIST; | 1668 state->role = ui::AX_ROLE_TAB_LIST; |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2886 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2888 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
| 2887 if (view) | 2889 if (view) |
| 2888 return view; | 2890 return view; |
| 2889 } | 2891 } |
| 2890 Tab* tab = FindTabForEvent(point); | 2892 Tab* tab = FindTabForEvent(point); |
| 2891 if (tab) | 2893 if (tab) |
| 2892 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2894 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
| 2893 } | 2895 } |
| 2894 return this; | 2896 return this; |
| 2895 } | 2897 } |
| OLD | NEW |