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

Side by Side Diff: ui/views/view.cc

Issue 354063003: View should store a ViewTargeter instead of an EventTargeter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compilation errors Created 6 years, 5 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 | Annotate | Revision Log
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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 InputMethod* View::GetInputMethod() { 1094 InputMethod* View::GetInputMethod() {
1095 Widget* widget = GetWidget(); 1095 Widget* widget = GetWidget();
1096 return widget ? widget->GetInputMethod() : NULL; 1096 return widget ? widget->GetInputMethod() : NULL;
1097 } 1097 }
1098 1098
1099 const InputMethod* View::GetInputMethod() const { 1099 const InputMethod* View::GetInputMethod() const {
1100 const Widget* widget = GetWidget(); 1100 const Widget* widget = GetWidget();
1101 return widget ? widget->GetInputMethod() : NULL; 1101 return widget ? widget->GetInputMethod() : NULL;
1102 } 1102 }
1103 1103
1104 scoped_ptr<ui::EventTargeter> 1104 scoped_ptr<ViewTargeter>
1105 View::SetEventTargeter(scoped_ptr<ui::EventTargeter> targeter) { 1105 View::SetEventTargeter(scoped_ptr<ViewTargeter> targeter) {
1106 scoped_ptr<ui::EventTargeter> old_targeter = targeter_.Pass(); 1106 scoped_ptr<ViewTargeter> old_targeter = targeter_.Pass();
1107 targeter_ = targeter.Pass(); 1107 targeter_ = targeter.Pass();
1108 return old_targeter.Pass(); 1108 return old_targeter.Pass();
1109 } 1109 }
1110 1110
1111 bool View::CanAcceptEvent(const ui::Event& event) { 1111 bool View::CanAcceptEvent(const ui::Event& event) {
1112 return IsDrawn(); 1112 return IsDrawn();
1113 } 1113 }
1114 1114
1115 ui::EventTarget* View::GetParentTarget() { 1115 ui::EventTarget* View::GetParentTarget() {
1116 return parent_; 1116 return parent_;
1117 } 1117 }
1118 1118
1119 scoped_ptr<ui::EventTargetIterator> View::GetChildIterator() const { 1119 scoped_ptr<ui::EventTargetIterator> View::GetChildIterator() const {
1120 return scoped_ptr<ui::EventTargetIterator>( 1120 return scoped_ptr<ui::EventTargetIterator>(
1121 new ui::EventTargetIteratorImpl<View>(children_)); 1121 new ui::EventTargetIteratorImpl<View>(children_));
1122 } 1122 }
1123 1123
1124 ViewTargeter* View::GetViewTargeter() const {
1125 return targeter_.get();
1126 }
1127
1124 ui::EventTargeter* View::GetEventTargeter() { 1128 ui::EventTargeter* View::GetEventTargeter() {
1125 return targeter_.get(); 1129 return targeter_.get();
1126 } 1130 }
1127 1131
1128 void View::ConvertEventToTarget(ui::EventTarget* target, 1132 void View::ConvertEventToTarget(ui::EventTarget* target,
1129 ui::LocatedEvent* event) { 1133 ui::LocatedEvent* event) {
1130 event->ConvertLocationToTarget(this, static_cast<View*>(target)); 1134 event->ConvertLocationToTarget(this, static_cast<View*>(target));
1131 } 1135 }
1132 1136
1133 // Accelerators ---------------------------------------------------------------- 1137 // Accelerators ----------------------------------------------------------------
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 // Message the RootView to do the drag and drop. That way if we're removed 2498 // Message the RootView to do the drag and drop. That way if we're removed
2495 // the RootView can detect it and avoid calling us back. 2499 // the RootView can detect it and avoid calling us back.
2496 gfx::Point widget_location(event.location()); 2500 gfx::Point widget_location(event.location());
2497 ConvertPointToWidget(this, &widget_location); 2501 ConvertPointToWidget(this, &widget_location);
2498 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2502 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2499 // WARNING: we may have been deleted. 2503 // WARNING: we may have been deleted.
2500 return true; 2504 return true;
2501 } 2505 }
2502 2506
2503 } // namespace views 2507 } // namespace views
OLDNEW
« ui/views/view.h ('K') | « ui/views/view.h ('k') | ui/views/view_targeter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698