File: native_web_keyboard_event.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (75 lines) | stat: -rw-r--r-- 2,559 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_INPUT_NATIVE_WEB_KEYBOARD_EVENT_H_
#define COMPONENTS_INPUT_NATIVE_WEB_KEYBOARD_EVENT_H_

#include "base/time/time.h"
#include "build/build_config.h"
#include "base/component_export.h"
#include "third_party/blink/public/common/input/web_keyboard_event.h"
#include "ui/gfx/native_widget_types.h"

#if BUILDFLAG(IS_ANDROID)
#include "base/android/scoped_java_ref.h"
#endif

namespace ui {
class KeyEvent;
}

namespace input {

// Owns a platform specific event; used to pass own and pass event through
// platform independent code.
struct COMPONENT_EXPORT(INPUT) NativeWebKeyboardEvent :
    public blink::WebKeyboardEvent {
  NativeWebKeyboardEvent(blink::WebInputEvent::Type type,
                         int modifiers,
                         base::TimeTicks timestamp);

  // Creates a native web keyboard event from a WebKeyboardEvent. The |os_event|
  // member may be a synthetic event, and possibly incomplete.
  NativeWebKeyboardEvent(const blink::WebKeyboardEvent& web_event,
                         gfx::NativeView native_view);

  explicit NativeWebKeyboardEvent(gfx::NativeEvent native_event);
#if BUILDFLAG(IS_ANDROID)
  // Holds a global ref to android_key_event (allowed to be null).
  NativeWebKeyboardEvent(
      JNIEnv* env,
      const base::android::JavaRef<jobject>& android_key_event,
      blink::WebInputEvent::Type type,
      int modifiers,
      base::TimeTicks timestamp,
      int keycode,
      int scancode,
      int unicode_character,
      bool is_system_key);
#else
  explicit NativeWebKeyboardEvent(const ui::KeyEvent& key_event);
#if defined(USE_AURA)
  // Create a legacy keypress event specified by |character|.
  NativeWebKeyboardEvent(const ui::KeyEvent& key_event, char16_t character);
#endif
#endif

  NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event);
  ~NativeWebKeyboardEvent() override;

  NativeWebKeyboardEvent& operator=(const NativeWebKeyboardEvent& event);

  gfx::NativeEvent os_event;

  // True if this event should be ignored (e.g. in the browser) if it's not
  // handled by the renderer. This happens for RawKeyDown events that are
  // created while IME is active and is necessary to prevent backspace from
  // doing "history back" if it is hit in ime mode. Currently, it's only used by
  // Linux and Mac ports.
  bool skip_if_unhandled;
};

}  // namespace input

#endif  // COMPONENTS_INPUT_NATIVE_WEB_KEYBOARD_EVENT_H_