Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Side by Side Diff: ui/views/widget/drop_helper.cc

Issue 2190773003: [ABANDONED] Simplify ash shelf dimmer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore an EventHandler object; fix behavior tests. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/widget/drop_helper.h ('k') | ui/views/widget/widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/widget/drop_helper.h" 5 #include "ui/views/widget/drop_helper.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "ui/base/dragdrop/drag_drop_types.h" 8 #include "ui/base/dragdrop/drag_drop_types.h"
9 #include "ui/views/view.h" 9 #include "ui/views/view.h"
10 #include "ui/views/widget/widget.h" 10 #include "ui/views/widget/widget.h"
11 11
12 namespace views { 12 namespace views {
13 13
14 DropHelper::DropHelper(View* root_view) 14 DropHelper::DropHelper(View* root_view) : root_view_(root_view) {}
15 : root_view_(root_view),
16 target_view_(NULL),
17 deepest_view_(NULL) {
18 }
19 15
20 DropHelper::~DropHelper() { 16 DropHelper::~DropHelper() {}
21 }
22 17
23 void DropHelper::ResetTargetViewIfEquals(View* view) { 18 void DropHelper::ResetTargetViewIfEquals(View* view) {
24 if (target_view_ == view) 19 if (target_view_ == view)
25 target_view_ = NULL; 20 target_view_ = NULL;
26 if (deepest_view_ == view) 21 if (deepest_view_ == view)
27 deepest_view_ = NULL; 22 deepest_view_ = NULL;
28 } 23 }
29 24
30 int DropHelper::OnDragOver(const OSExchangeData& data, 25 int DropHelper::OnDragOver(const OSExchangeData& data,
31 const gfx::Point& root_view_location, 26 const gfx::Point& root_view_location,
32 int drag_operation) { 27 int drag_operation) {
28 LOG(ERROR) << "MSW DropHelper::OnDragOver";
29 if (!drag_over_widget_)
30 root_view_->GetWidget()->OnDragEnter();
31 drag_over_widget_ = true;
32
33 View* view = CalculateTargetViewImpl(root_view_location, data, true, 33 View* view = CalculateTargetViewImpl(root_view_location, data, true,
34 &deepest_view_); 34 &deepest_view_);
35 35
36 if (view != target_view_) { 36 if (view != target_view_) {
37 // Target changed notify old drag exited, then new drag entered. 37 // Target changed notify old drag exited, then new drag entered.
38 NotifyDragExit(); 38 NotifyDragExit();
39 target_view_ = view; 39 target_view_ = view;
40 NotifyDragEntered(data, root_view_location, drag_operation); 40 NotifyDragEntered(data, root_view_location, drag_operation);
41 } 41 }
42 42
43 return NotifyDragOver(data, root_view_location, drag_operation); 43 return NotifyDragOver(data, root_view_location, drag_operation);
44 } 44 }
45 45
46 void DropHelper::OnDragExit() { 46 void DropHelper::OnDragExit() {
47 root_view_->GetWidget()->OnDragExit();
48 drag_over_widget_ = false;
47 NotifyDragExit(); 49 NotifyDragExit();
48 deepest_view_ = target_view_ = NULL; 50 deepest_view_ = target_view_ = NULL;
49 } 51 }
50 52
51 int DropHelper::OnDrop(const OSExchangeData& data, 53 int DropHelper::OnDrop(const OSExchangeData& data,
52 const gfx::Point& root_view_location, 54 const gfx::Point& root_view_location,
53 int drag_operation) { 55 int drag_operation) {
56 root_view_->GetWidget()->OnDragExit();
57 drag_over_widget_ = false;
58
54 View* drop_view = target_view_; 59 View* drop_view = target_view_;
55 deepest_view_ = target_view_ = NULL; 60 deepest_view_ = target_view_ = NULL;
56 if (!drop_view) 61 if (!drop_view)
57 return ui::DragDropTypes::DRAG_NONE; 62 return ui::DragDropTypes::DRAG_NONE;
58 63
59 if (drag_operation == ui::DragDropTypes::DRAG_NONE) { 64 if (drag_operation == ui::DragDropTypes::DRAG_NONE) {
60 drop_view->OnDragExited(); 65 drop_view->OnDragExited();
61 return ui::DragDropTypes::DRAG_NONE; 66 return ui::DragDropTypes::DRAG_NONE;
62 } 67 }
63 68
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 drag_operation); 153 drag_operation);
149 return target_view_->OnDragUpdated(enter_event); 154 return target_view_->OnDragUpdated(enter_event);
150 } 155 }
151 156
152 void DropHelper::NotifyDragExit() { 157 void DropHelper::NotifyDragExit() {
153 if (target_view_) 158 if (target_view_)
154 target_view_->OnDragExited(); 159 target_view_->OnDragExited();
155 } 160 }
156 161
157 } // namespace views 162 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/drop_helper.h ('k') | ui/views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698