| 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 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1607 | 1607 |
| 1608 void TabStrip::OnDragEntered(const DropTargetEvent& event) { | 1608 void TabStrip::OnDragEntered(const DropTargetEvent& event) { |
| 1609 // Force animations to stop, otherwise it makes the index calculation tricky. | 1609 // Force animations to stop, otherwise it makes the index calculation tricky. |
| 1610 StopAnimating(true); | 1610 StopAnimating(true); |
| 1611 | 1611 |
| 1612 UpdateDropIndex(event); | 1612 UpdateDropIndex(event); |
| 1613 | 1613 |
| 1614 GURL url; | 1614 GURL url; |
| 1615 base::string16 title; | 1615 base::string16 title; |
| 1616 | 1616 |
| 1617 // todo: move PasteAndGo logic from browser_view to tab_strip, so |
| 1618 // it has identical behavior in all cases. |
| 1617 // Check whether the event data includes supported drop data. | 1619 // Check whether the event data includes supported drop data. |
| 1618 if (event.data().GetURLAndTitle( | 1620 if (event.data().GetURLAndTitle(ui::OSExchangeData::CONVERT_FILENAMES, |
| 1619 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title) && | 1621 ui::OSExchangeData::PARSE_TEXT_AS_URL, &url, |
| 1622 &title) && |
| 1620 url.is_valid()) { | 1623 url.is_valid()) { |
| 1621 drop_info_->url = url; | 1624 drop_info_->url = url; |
| 1622 | 1625 |
| 1623 // For file:// URLs, kick off a MIME type request in case they're dropped. | 1626 // For file:// URLs, kick off a MIME type request in case they're dropped. |
| 1624 if (url.SchemeIsFile()) | 1627 if (url.SchemeIsFile()) |
| 1625 controller_->CheckFileSupported(url); | 1628 controller_->CheckFileSupported(url); |
| 1626 } | 1629 } |
| 1627 } | 1630 } |
| 1628 | 1631 |
| 1629 int TabStrip::OnDragUpdated(const DropTargetEvent& event) { | 1632 int TabStrip::OnDragUpdated(const DropTargetEvent& event) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1650 const bool file_supported = drop_info_->file_supported; | 1653 const bool file_supported = drop_info_->file_supported; |
| 1651 | 1654 |
| 1652 // Hide the drop indicator. | 1655 // Hide the drop indicator. |
| 1653 SetDropIndex(-1, false); | 1656 SetDropIndex(-1, false); |
| 1654 | 1657 |
| 1655 // Do nothing if the file was unsupported or the URL is invalid. The URL may | 1658 // Do nothing if the file was unsupported or the URL is invalid. The URL may |
| 1656 // have been changed after |drop_info_| was created. | 1659 // have been changed after |drop_info_| was created. |
| 1657 GURL url; | 1660 GURL url; |
| 1658 base::string16 title; | 1661 base::string16 title; |
| 1659 if (!file_supported || | 1662 if (!file_supported || |
| 1660 !event.data().GetURLAndTitle( | 1663 !event.data().GetURLAndTitle(ui::OSExchangeData::CONVERT_FILENAMES, |
| 1661 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title) || | 1664 ui::OSExchangeData::DO_NOT_PARSE_TEXT_AS_URL, |
| 1665 &url, &title) || |
| 1662 !url.is_valid()) | 1666 !url.is_valid()) |
| 1663 return ui::DragDropTypes::DRAG_NONE; | 1667 return ui::DragDropTypes::DRAG_NONE; |
| 1664 | 1668 |
| 1665 controller_->PerformDrop(drop_before, drop_index, url); | 1669 controller_->PerformDrop(drop_before, drop_index, url); |
| 1666 | 1670 |
| 1667 return GetDropEffect(event); | 1671 return GetDropEffect(event); |
| 1668 } | 1672 } |
| 1669 | 1673 |
| 1670 void TabStrip::GetAccessibleState(ui::AXViewState* state) { | 1674 void TabStrip::GetAccessibleState(ui::AXViewState* state) { |
| 1671 state->role = ui::AX_ROLE_TAB_LIST; | 1675 state->role = ui::AX_ROLE_TAB_LIST; |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2891 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2895 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
| 2892 if (view) | 2896 if (view) |
| 2893 return view; | 2897 return view; |
| 2894 } | 2898 } |
| 2895 Tab* tab = FindTabForEvent(point); | 2899 Tab* tab = FindTabForEvent(point); |
| 2896 if (tab) | 2900 if (tab) |
| 2897 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2901 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
| 2898 } | 2902 } |
| 2899 return this; | 2903 return this; |
| 2900 } | 2904 } |
| OLD | NEW |