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

Side by Side Diff: ui/events/platform/platform_event_source.cc

Issue 666673005: Explicitly coerce PostDispatchAction to uint32_t in DispatchEvent() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ui_enums
Patch Set: sigh. Windows. Created 6 years, 2 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
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 CHECK(observer); 56 CHECK(observer);
57 observers_.AddObserver(observer); 57 observers_.AddObserver(observer);
58 } 58 }
59 59
60 void PlatformEventSource::RemovePlatformEventObserver( 60 void PlatformEventSource::RemovePlatformEventObserver(
61 PlatformEventObserver* observer) { 61 PlatformEventObserver* observer) {
62 observers_.RemoveObserver(observer); 62 observers_.RemoveObserver(observer);
63 } 63 }
64 64
65 uint32_t PlatformEventSource::DispatchEvent(PlatformEvent platform_event) { 65 uint32_t PlatformEventSource::DispatchEvent(PlatformEvent platform_event) {
66 uint32_t action = POST_DISPATCH_PERFORM_DEFAULT; 66 uint32_t action = kPostDispatchPerformDefault;
67 67
68 FOR_EACH_OBSERVER(PlatformEventObserver, observers_, 68 FOR_EACH_OBSERVER(PlatformEventObserver, observers_,
69 WillProcessEvent(platform_event)); 69 WillProcessEvent(platform_event));
70 // Give the overridden dispatcher a chance to dispatch the event first. 70 // Give the overridden dispatcher a chance to dispatch the event first.
71 if (overridden_dispatcher_) 71 if (overridden_dispatcher_)
72 action = overridden_dispatcher_->DispatchEvent(platform_event); 72 action = overridden_dispatcher_->DispatchEvent(platform_event);
73 73
74 if ((action & POST_DISPATCH_PERFORM_DEFAULT) && 74 if ((action & kPostDispatchPerformDefault) &&
75 dispatchers_.might_have_observers()) { 75 dispatchers_.might_have_observers()) {
76 ObserverList<PlatformEventDispatcher>::Iterator iter(dispatchers_); 76 ObserverList<PlatformEventDispatcher>::Iterator iter(dispatchers_);
77 while (PlatformEventDispatcher* dispatcher = iter.GetNext()) { 77 while (PlatformEventDispatcher* dispatcher = iter.GetNext()) {
78 if (dispatcher->CanDispatchEvent(platform_event)) 78 if (dispatcher->CanDispatchEvent(platform_event))
79 action = dispatcher->DispatchEvent(platform_event); 79 action = dispatcher->DispatchEvent(platform_event);
80 if (action & POST_DISPATCH_STOP_PROPAGATION) 80 if (action & kPostDispatchStopPropagation)
81 break; 81 break;
82 } 82 }
83 } 83 }
84 FOR_EACH_OBSERVER(PlatformEventObserver, observers_, 84 FOR_EACH_OBSERVER(PlatformEventObserver, observers_,
85 DidProcessEvent(platform_event)); 85 DidProcessEvent(platform_event));
86 86
87 // If an overridden dispatcher has been destroyed, then the platform 87 // If an overridden dispatcher has been destroyed, then the platform
88 // event-source should halt dispatching the current stream of events, and wait 88 // event-source should halt dispatching the current stream of events, and wait
89 // until the next message-loop iteration for dispatching events. This lets any 89 // until the next message-loop iteration for dispatching events. This lets any
90 // nested message-loop to unwind correctly and any new dispatchers to receive 90 // nested message-loop to unwind correctly and any new dispatchers to receive
(...skipping 11 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698