summaryrefslogtreecommitdiffstats
path: root/chrome/common/native_web_keyboard_event_win.cc
blob: 7608ec64f4040429ad20e4c04db8c437de5122b0 (plain)
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
// Copyright (c) 2009 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 "chrome/common/native_web_keyboard_event.h"

#include "third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h"

using WebKit::WebInputEventFactory;
using WebKit::WebKeyboardEvent;

NativeWebKeyboardEvent::NativeWebKeyboardEvent()
    : skip_in_browser(false) {
  memset(&os_event, 0, sizeof(os_event));
}

NativeWebKeyboardEvent::NativeWebKeyboardEvent(
    HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
    : WebKeyboardEvent(
          WebInputEventFactory::keyboardEvent(hwnd, message, wparam, lparam)),
      skip_in_browser(false) {
  os_event.hwnd = hwnd;
  os_event.message = message;
  os_event.wParam = wparam;
  os_event.lParam = lparam;
}

NativeWebKeyboardEvent::NativeWebKeyboardEvent(
    const NativeWebKeyboardEvent& other)
    : WebKeyboardEvent(other),
      skip_in_browser(other.skip_in_browser) {
  os_event.hwnd = other.os_event.hwnd;
  os_event.message = other.os_event.message;
  os_event.wParam = other.os_event.wParam;
  os_event.lParam = other.os_event.lParam;
}

NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=(
    const NativeWebKeyboardEvent& other) {
  WebKeyboardEvent::operator=(other);

  os_event.hwnd = other.os_event.hwnd;
  os_event.message = other.os_event.message;
  os_event.wParam = other.os_event.wParam;
  os_event.lParam = other.os_event.lParam;

  skip_in_browser = other.skip_in_browser;

  return *this;
}

NativeWebKeyboardEvent::~NativeWebKeyboardEvent() {
  // Noop under windows
}