| 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 "ui/events/platform/platform_event_source.h" | 5 #include "ui/events/platform/platform_event_source.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "ui/events/platform/platform_event_dispatcher.h" | 10 #include "ui/events/platform/platform_event_dispatcher.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 uint32_t action = POST_DISPATCH_PERFORM_DEFAULT; | 69 uint32_t action = POST_DISPATCH_PERFORM_DEFAULT; |
| 70 | 70 |
| 71 FOR_EACH_OBSERVER(PlatformEventObserver, observers_, | 71 FOR_EACH_OBSERVER(PlatformEventObserver, observers_, |
| 72 WillProcessEvent(platform_event)); | 72 WillProcessEvent(platform_event)); |
| 73 // Give the overridden dispatcher a chance to dispatch the event first. | 73 // Give the overridden dispatcher a chance to dispatch the event first. |
| 74 if (overridden_dispatcher_) | 74 if (overridden_dispatcher_) |
| 75 action = overridden_dispatcher_->DispatchEvent(platform_event); | 75 action = overridden_dispatcher_->DispatchEvent(platform_event); |
| 76 | 76 |
| 77 if ((action & POST_DISPATCH_PERFORM_DEFAULT) && | 77 if ((action & POST_DISPATCH_PERFORM_DEFAULT) && |
| 78 dispatchers_.might_have_observers()) { | 78 dispatchers_.might_have_observers()) { |
| 79 ObserverList<PlatformEventDispatcher>::Iterator iter(dispatchers_); | 79 ObserverList<PlatformEventDispatcher>::Iterator iter(&dispatchers_); |
| 80 while (PlatformEventDispatcher* dispatcher = iter.GetNext()) { | 80 while (PlatformEventDispatcher* dispatcher = iter.GetNext()) { |
| 81 if (dispatcher->CanDispatchEvent(platform_event)) | 81 if (dispatcher->CanDispatchEvent(platform_event)) |
| 82 action = dispatcher->DispatchEvent(platform_event); | 82 action = dispatcher->DispatchEvent(platform_event); |
| 83 if (action & POST_DISPATCH_STOP_PROPAGATION) | 83 if (action & POST_DISPATCH_STOP_PROPAGATION) |
| 84 break; | 84 break; |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 FOR_EACH_OBSERVER(PlatformEventObserver, observers_, | 87 FOR_EACH_OBSERVER(PlatformEventObserver, observers_, |
| 88 DidProcessEvent(platform_event)); | 88 DidProcessEvent(platform_event)); |
| 89 | 89 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 102 | 102 |
| 103 void PlatformEventSource::OnDispatcherListChanged() { | 103 void PlatformEventSource::OnDispatcherListChanged() { |
| 104 } | 104 } |
| 105 | 105 |
| 106 void PlatformEventSource::OnOverriddenDispatcherRestored() { | 106 void PlatformEventSource::OnOverriddenDispatcherRestored() { |
| 107 CHECK(overridden_dispatcher_); | 107 CHECK(overridden_dispatcher_); |
| 108 overridden_dispatcher_restored_ = true; | 108 overridden_dispatcher_restored_ = true; |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace ui | 111 } // namespace ui |
| OLD | NEW |