| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/window_manager/view_target.h" | 5 #include "services/window_manager/view_target.h" |
| 6 | 6 |
| 7 #include "mojo/converters/geometry/geometry_type_converters.h" | 7 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 8 #include "mojo/services/view_manager/cpp/view.h" | 8 #include "mojo/services/view_manager/cpp/view.h" |
| 9 #include "mojo/services/view_manager/cpp/view_property.h" | 9 #include "mojo/services/view_manager/cpp/view_property.h" |
| 10 #include "services/window_manager/view_targeter.h" | 10 #include "services/window_manager/view_targeter.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 const ViewTarget* root = this; | 84 const ViewTarget* root = this; |
| 85 for (const ViewTarget* parent = this; parent; parent = parent->GetParent()) | 85 for (const ViewTarget* parent = this; parent; parent = parent->GetParent()) |
| 86 root = parent; | 86 root = parent; |
| 87 return root; | 87 return root; |
| 88 } | 88 } |
| 89 | 89 |
| 90 scoped_ptr<ViewTargeter> ViewTarget::SetEventTargeter( | 90 scoped_ptr<ViewTargeter> ViewTarget::SetEventTargeter( |
| 91 scoped_ptr<ViewTargeter> targeter) { | 91 scoped_ptr<ViewTargeter> targeter) { |
| 92 scoped_ptr<ViewTargeter> old_targeter = targeter_.Pass(); | 92 scoped_ptr<ViewTargeter> old_targeter = targeter_.Pass(); |
| 93 targeter_ = targeter.Pass(); | 93 targeter_ = targeter.Pass(); |
| 94 return old_targeter.Pass(); | 94 return old_targeter; |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool ViewTarget::CanAcceptEvent(const ui::Event& event) { | 97 bool ViewTarget::CanAcceptEvent(const ui::Event& event) { |
| 98 // We need to make sure that a touch cancel event and any gesture events it | 98 // We need to make sure that a touch cancel event and any gesture events it |
| 99 // creates can always reach the window. This ensures that we receive a valid | 99 // creates can always reach the window. This ensures that we receive a valid |
| 100 // touch / gesture stream. | 100 // touch / gesture stream. |
| 101 if (event.IsEndingEvent()) | 101 if (event.IsEndingEvent()) |
| 102 return true; | 102 return true; |
| 103 | 103 |
| 104 if (!view_->visible()) | 104 if (!view_->visible()) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 gfx::Vector2d* offset) const { | 158 gfx::Vector2d* offset) const { |
| 159 const ViewTarget* v = this; | 159 const ViewTarget* v = this; |
| 160 for (; v && v != ancestor; v = v->GetParent()) { | 160 for (; v && v != ancestor; v = v->GetParent()) { |
| 161 gfx::Rect bounds = v->GetBounds(); | 161 gfx::Rect bounds = v->GetBounds(); |
| 162 *offset += gfx::Vector2d(bounds.x(), bounds.y()); | 162 *offset += gfx::Vector2d(bounds.x(), bounds.y()); |
| 163 } | 163 } |
| 164 return v == ancestor; | 164 return v == ancestor; |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace window_manager | 167 } // namespace window_manager |
| OLD | NEW |