Commit 666900e1 authored by jam@chromium.org's avatar jam@chromium.org

Move native_web_keyboard_event_views.cc to chrome, so that we don't have any...

Move native_web_keyboard_event_views.cc to chrome, so that we don't have any views code in content. Although this is now away from the other NativeWebKeyboardEvent implementations, it's at least in the same module as the rest of the views related implementations like RenderWidgetHostViewViews and TabContentViewViews which use it.
Review URL: http://codereview.chromium.org/7766012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98570 0039d316-1c4b-4281-b951-d872f2087c98
parent e1249b3f
......@@ -14,10 +14,10 @@
#include "base/task.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/native_web_keyboard_event_views.h"
#include "chrome/common/render_messages.h"
#include "content/browser/renderer_host/backing_store_skia.h"
#include "content/browser/renderer_host/render_widget_host.h"
#include "content/common/native_web_keyboard_event.h"
#include "content/common/result_codes.h"
#include "content/common/view_messages.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
......@@ -488,14 +488,14 @@ bool RenderWidgetHostViewViews::OnKeyPressed(const views::KeyEvent& event) {
// TODO(suzhe): Support editor key bindings.
if (!host_)
return false;
host_->ForwardKeyboardEvent(NativeWebKeyboardEvent(event));
host_->ForwardKeyboardEvent(NativeWebKeyboardEventViews(event));
return true;
}
bool RenderWidgetHostViewViews::OnKeyReleased(const views::KeyEvent& event) {
if (!host_)
return false;
host_->ForwardKeyboardEvent(NativeWebKeyboardEvent(event));
host_->ForwardKeyboardEvent(NativeWebKeyboardEventViews(event));
return true;
}
......@@ -578,8 +578,8 @@ void RenderWidgetHostViewViews::InsertText(const string16& text) {
void RenderWidgetHostViewViews::InsertChar(char16 ch, int flags) {
if (host_) {
NativeWebKeyboardEvent::FromViewsEvent from_views_event;
NativeWebKeyboardEvent wke(ch, flags, base::Time::Now().ToDoubleT(),
NativeWebKeyboardEventViews::FromViewsEvent from_views_event;
NativeWebKeyboardEventViews wke(ch, flags, base::Time::Now().ToDoubleT(),
from_views_event);
host_->ForwardKeyboardEvent(wke);
}
......
......@@ -265,6 +265,12 @@
],
},
},],
['toolkit_views==1', {
'sources': [
'common/native_web_keyboard_event_views.cc',
'common/native_web_keyboard_event_views.h',
],
}],
['os_posix == 1 and OS != "mac"', {
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)',
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/common/native_web_keyboard_event.h"
#include "chrome/common/native_web_keyboard_event_views.h"
#if defined(TOOLKIT_USES_GTK)
#include <gdk/gdk.h>
......@@ -23,9 +23,9 @@ int ViewsFlagsToWebInputEventModifiers(int flags) {
} // namespace
NativeWebKeyboardEvent::NativeWebKeyboardEvent(
const views::KeyEvent& event)
: skip_in_browser(false) {
NativeWebKeyboardEventViews::NativeWebKeyboardEventViews(
const views::KeyEvent& event) {
skip_in_browser = false;
DCHECK(event.type() == ui::ET_KEY_PRESSED ||
event.type() == ui::ET_KEY_RELEASED);
......@@ -60,11 +60,13 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent(
#endif
}
NativeWebKeyboardEvent::NativeWebKeyboardEvent(uint16 character,
NativeWebKeyboardEventViews::NativeWebKeyboardEventViews(
uint16 character,
int flags,
double time_stamp_seconds,
FromViewsEvent)
: skip_in_browser(true) {
FromViewsEvent) {
skip_in_browser = true;
type = WebKit::WebInputEvent::Char;
modifiers = ViewsFlagsToWebInputEventModifiers(flags);
timeStampSeconds = time_stamp_seconds;
......@@ -84,3 +86,6 @@ NativeWebKeyboardEvent::NativeWebKeyboardEvent(uint16 character,
match_edit_command = false;
#endif
}
NativeWebKeyboardEventViews::~NativeWebKeyboardEventViews() {
}
// Copyright (c) 2011 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.
#ifndef CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_VIEWS_H_
#define CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_VIEWS_H_
#pragma once
#include "content/common/native_web_keyboard_event.h"
namespace views {
class KeyEvent;
}
// A views implementation of NativeWebKeyboardEvent.
struct NativeWebKeyboardEventViews : public NativeWebKeyboardEvent {
// TODO(suzhe): remove once we get rid of Gtk from Views.
struct FromViewsEvent {};
// These two constructors are shared between Windows and Linux Views ports.
explicit NativeWebKeyboardEventViews(const views::KeyEvent& event);
// TODO(suzhe): Sadly, we need to add a meanless FromViewsEvent parameter to
// distinguish between this contructor and above Gtk one, because they use
// different modifier flags. We can remove this extra parameter as soon as we
// disable above Gtk constructor in Linux Views port.
NativeWebKeyboardEventViews(uint16 character,
int flags,
double time_stamp_seconds,
FromViewsEvent);
~NativeWebKeyboardEventViews();
};
#endif // CHROME_COMMON_NATIVE_WEB_KEYBOARD_EVENT_VIEWS_H_
......@@ -22,12 +22,6 @@ class NSEvent;
typedef struct _GdkEventKey GdkEventKey;
#endif
#if defined(TOOLKIT_VIEWS)
namespace views {
class KeyEvent;
}
#endif
// Owns a platform specific event; used to pass own and pass event through
// platform independent code.
struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
......@@ -51,21 +45,6 @@ struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
double time_stamp_seconds);
#endif
#if defined(TOOLKIT_VIEWS)
// TODO(suzhe): remove once we get rid of Gtk from Views.
struct FromViewsEvent {};
// These two constructors are shared between Windows and Linux Views ports.
explicit NativeWebKeyboardEvent(const views::KeyEvent& event);
// TODO(suzhe): Sadly, we need to add a meanless FromViewsEvent parameter to
// distinguish between this contructor and above Gtk one, because they use
// different modifier flags. We can remove this extra parameter as soon as we
// disable above Gtk constructor in Linux Views port.
NativeWebKeyboardEvent(uint16 character,
int flags,
double time_stamp_seconds,
FromViewsEvent);
#endif
NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event);
~NativeWebKeyboardEvent();
......
......@@ -282,11 +282,6 @@
'common/gpu/x_util.h',
],
}],
['toolkit_views==1', {
'sources': [
'common/native_web_keyboard_event_views.cc',
],
}],
['touchui==1', {
'sources': [
'common/gpu/image_transport_surface_linux.h',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment