blob: 79b519b3c04fcd4301eb68f25955770fe11c0386 [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/auto_reset.h"
#include "base/macros.h"
#include "ui/events/events_export.h"
namespace ui {
class PlatformEventDispatcher;
// A temporary PlatformEventDispatcher can be installed on a
// PlatformEventSource that overrides all installed event dispatchers, and
// always gets a chance to dispatch the event first. The PlatformEventSource
// returns a ScopedEventDispatcher object in such cases. This
// ScopedEventDispatcher object can be used to dispatch the event to any
// previous overridden dispatcher. When this object is destroyed, it removes the
// override-dispatcher, and restores the previous override-dispatcher.
class EVENTS_EXPORT ScopedEventDispatcher {
ScopedEventDispatcher(PlatformEventDispatcher** scoped_dispatcher,
PlatformEventDispatcher* new_dispatcher);
operator PlatformEventDispatcher*() const { return original_; }
PlatformEventDispatcher* original_;
base::AutoReset<PlatformEventDispatcher*> restore_;
} // namespace ui