| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/views/widget/drop_helper.h" | 5 #include "ui/views/widget/drop_helper.h" |
| 6 | 6 |
| 7 #include "ui/base/dragdrop/drag_drop_types.h" | 7 #include "ui/base/dragdrop/drag_drop_types.h" |
| 8 #include "ui/views/view.h" | 8 #include "ui/views/view.h" |
| 9 #include "ui/views/widget/widget.h" | 9 #include "ui/views/widget/widget.h" |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 if (deepest_view) | 89 if (deepest_view) |
| 90 *deepest_view = view; | 90 *deepest_view = view; |
| 91 // TODO(sky): for the time being these are separate. Once I port chrome menu | 91 // TODO(sky): for the time being these are separate. Once I port chrome menu |
| 92 // I can switch to the #else implementation and nuke the OS_WIN | 92 // I can switch to the #else implementation and nuke the OS_WIN |
| 93 // implementation. | 93 // implementation. |
| 94 #if defined(OS_WIN) | 94 #if defined(OS_WIN) |
| 95 // View under mouse changed, which means a new view may want the drop. | 95 // View under mouse changed, which means a new view may want the drop. |
| 96 // Walk the tree, stopping at target_view_ as we know it'll accept the | 96 // Walk the tree, stopping at target_view_ as we know it'll accept the |
| 97 // drop. | 97 // drop. |
| 98 while (view && view != target_view_ && | 98 while (view && view != target_view_ && |
| 99 (!view->IsEnabled() || !view->CanDrop(data))) { | 99 (!view->enabled() || !view->CanDrop(data))) { |
| 100 view = view->parent(); | 100 view = view->parent(); |
| 101 } | 101 } |
| 102 #else | 102 #else |
| 103 int formats = 0; | 103 int formats = 0; |
| 104 std::set<OSExchangeData::CustomFormat> custom_formats; | 104 std::set<OSExchangeData::CustomFormat> custom_formats; |
| 105 while (view && view != target_view_) { | 105 while (view && view != target_view_) { |
| 106 if (view->IsEnabled() && | 106 if (view->enabled() && |
| 107 view->GetDropFormats(&formats, &custom_formats) && | 107 view->GetDropFormats(&formats, &custom_formats) && |
| 108 data.HasAnyFormat(formats, custom_formats) && | 108 data.HasAnyFormat(formats, custom_formats) && |
| 109 (!check_can_drop || view->CanDrop(data))) { | 109 (!check_can_drop || view->CanDrop(data))) { |
| 110 // Found the view. | 110 // Found the view. |
| 111 return view; | 111 return view; |
| 112 } | 112 } |
| 113 formats = 0; | 113 formats = 0; |
| 114 custom_formats.clear(); | 114 custom_formats.clear(); |
| 115 view = view->parent(); | 115 view = view->parent(); |
| 116 } | 116 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 147 drag_operation); | 147 drag_operation); |
| 148 return target_view_->OnDragUpdated(enter_event); | 148 return target_view_->OnDragUpdated(enter_event); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void DropHelper::NotifyDragExit() { | 151 void DropHelper::NotifyDragExit() { |
| 152 if (target_view_) | 152 if (target_view_) |
| 153 target_view_->OnDragExited(); | 153 target_view_->OnDragExited(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace views | 156 } // namespace views |
| OLD | NEW |