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