Home | History | Annotate | Download | only in ozone
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef UI_EVENTS_OZONE_EVENTS_OZONE_H_
      6 #define UI_EVENTS_OZONE_EVENTS_OZONE_H_
      7 
      8 #include "base/callback.h"
      9 #include "base/event_types.h"
     10 #include "ui/events/events_export.h"
     11 
     12 namespace ui {
     13 
     14 class Event;
     15 
     16 // Wrap a "native" ui::Event in another ui::Event & dispatch it.
     17 //
     18 // This is really unfortunate, but exists for two reasons:
     19 //
     20 //   1. Some of the ui::Event constructors depend on global state that
     21 //   is only used when building from a "native" event. For example:
     22 //   last_click_event_ is used when constructing MouseEvent from
     23 //   NativeEvent to determine click count.
     24 //
     25 //   2. Events contain a reference to a "native event", which some code
     26 //   depends on. The ui::Event might get mutated during dispatch, but
     27 //   the native event won't. Some code depends on the fact that the
     28 //   "native" version of the event is unmodified.
     29 //
     30 // We are trying to fix both of these issues, but in the meantime we
     31 // define NativeEvent == ui::Event.
     32 //
     33 EVENTS_EXPORT void DispatchEventFromNativeUiEvent(
     34     const base::NativeEvent& native_event,
     35     base::Callback<void(ui::Event*)> callback);
     36 
     37 }  // namespace ui
     38 
     39 #endif  // UI_EVENTS_OZONE_EVENTS_OZONE_H_
     40