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 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1622 } | 1622 } |
1623 | 1623 |
1624 int TabStrip::OnDragUpdated(const DropTargetEvent& event) { | 1624 int TabStrip::OnDragUpdated(const DropTargetEvent& event) { |
1625 // Update the drop index even if the file is unsupported, to allow | 1625 // Update the drop index even if the file is unsupported, to allow |
1626 // dragging a file to the contents of another tab. | 1626 // dragging a file to the contents of another tab. |
1627 UpdateDropIndex(event); | 1627 UpdateDropIndex(event); |
1628 | 1628 |
1629 if (!drop_info_->file_supported) | 1629 if (!drop_info_->file_supported) |
1630 return ui::DragDropTypes::DRAG_NONE; | 1630 return ui::DragDropTypes::DRAG_NONE; |
1631 | 1631 |
1632 if ((drop_info_->url).SchemeIs(url::kJavaScriptScheme)) | |
Peter Kasting
2016/09/09 20:43:06
Nit: Remove unnecessary first set of parens. Comb
elawrence
2016/09/12 21:42:58
Done.
| |
1633 return ui::DragDropTypes::DRAG_NONE; | |
1634 | |
1632 return GetDropEffect(event); | 1635 return GetDropEffect(event); |
1633 } | 1636 } |
1634 | 1637 |
1635 void TabStrip::OnDragExited() { | 1638 void TabStrip::OnDragExited() { |
1636 SetDropIndex(-1, false); | 1639 SetDropIndex(-1, false); |
1637 } | 1640 } |
1638 | 1641 |
1639 int TabStrip::OnPerformDrop(const DropTargetEvent& event) { | 1642 int TabStrip::OnPerformDrop(const DropTargetEvent& event) { |
1640 if (!drop_info_.get()) | 1643 if (!drop_info_.get()) |
1641 return ui::DragDropTypes::DRAG_NONE; | 1644 return ui::DragDropTypes::DRAG_NONE; |
1642 | 1645 |
1643 const int drop_index = drop_info_->drop_index; | 1646 const int drop_index = drop_info_->drop_index; |
1644 const bool drop_before = drop_info_->drop_before; | 1647 const bool drop_before = drop_info_->drop_before; |
1645 const bool file_supported = drop_info_->file_supported; | 1648 const bool file_supported = drop_info_->file_supported; |
1646 | 1649 |
1647 // Hide the drop indicator. | 1650 // Hide the drop indicator. |
1648 SetDropIndex(-1, false); | 1651 SetDropIndex(-1, false); |
1649 | 1652 |
1650 // Do nothing if the file was unsupported or the URL is invalid. The URL may | 1653 // Do nothing if the file was unsupported or the URL is invalid. The URL may |
Peter Kasting
2016/09/09 20:43:06
Nit: "...the file is unsupported, the URL is inval
elawrence
2016/09/12 21:42:58
Done.
| |
1651 // have been changed after |drop_info_| was created. | 1654 // have been changed after |drop_info_| was created. |
1652 GURL url; | 1655 GURL url; |
1653 base::string16 title; | 1656 base::string16 title; |
1654 if (!file_supported || | 1657 if (!file_supported || |
1655 !event.data().GetURLAndTitle( | 1658 !event.data().GetURLAndTitle( |
1656 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title) || | 1659 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title) || |
1657 !url.is_valid()) | 1660 !url.is_valid() || |
1661 url.SchemeIs(url::kJavaScriptScheme)) | |
1658 return ui::DragDropTypes::DRAG_NONE; | 1662 return ui::DragDropTypes::DRAG_NONE; |
1659 | 1663 |
1660 controller_->PerformDrop(drop_before, drop_index, url); | 1664 controller_->PerformDrop(drop_before, drop_index, url); |
1661 | 1665 |
1662 return GetDropEffect(event); | 1666 return GetDropEffect(event); |
1663 } | 1667 } |
1664 | 1668 |
1665 void TabStrip::GetAccessibleState(ui::AXViewState* state) { | 1669 void TabStrip::GetAccessibleState(ui::AXViewState* state) { |
1666 state->role = ui::AX_ROLE_TAB_LIST; | 1670 state->role = ui::AX_ROLE_TAB_LIST; |
1667 } | 1671 } |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2886 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2890 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
2887 if (view) | 2891 if (view) |
2888 return view; | 2892 return view; |
2889 } | 2893 } |
2890 Tab* tab = FindTabForEvent(point); | 2894 Tab* tab = FindTabForEvent(point); |
2891 if (tab) | 2895 if (tab) |
2892 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2896 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
2893 } | 2897 } |
2894 return this; | 2898 return this; |
2895 } | 2899 } |
OLD | NEW |