summaryrefslogtreecommitdiffstats
path: root/remoting/client
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-20 18:53:59 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-20 18:53:59 +0000
commit38d035e33fc2fac4f5c23819c6974afe2caff47b (patch)
tree82ecf8f419fbc6aafda5a068c03af0b1dd5acc75 /remoting/client
parente43145482ea2623ef59ff8c4cc5c10ccad8302a9 (diff)
downloadchromium_src-38d035e33fc2fac4f5c23819c6974afe2caff47b.zip
chromium_src-38d035e33fc2fac4f5c23819c6974afe2caff47b.tar.gz
chromium_src-38d035e33fc2fac4f5c23819c6974afe2caff47b.tar.bz2
Revert 93223 - Reland http://codereview.chromium.org/7452002/
Update chromoting input events. (Clang caught this. Thanks, Clang!) Note I'm leaving in temporary backwards-compatibility. brettw, just need a rubber-stamp. This is the same as the last CL. awong/garykac/sergeyu, looking for someone on chromoting team to glance at my changes and make sure I didn't do anything you don't like. This is a high priority for 14, so please look if you can. BUG=None TEST=ppapi tests Review URL: http://codereview.chromium.org/7466002 TBR=dmichael@chromium.org Review URL: http://codereview.chromium.org/7471006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93229 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/client')
-rw-r--r--remoting/client/plugin/chromoting_instance.cc43
-rw-r--r--remoting/client/plugin/chromoting_instance.h4
-rw-r--r--remoting/client/plugin/pepper_input_handler.cc28
-rw-r--r--remoting/client/plugin/pepper_input_handler.h15
4 files changed, 37 insertions, 53 deletions
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index 0bfa05eb3..e253641 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -19,8 +19,8 @@
// crbug.com/74951
#include "content/renderer/p2p/ipc_network_manager.h"
#include "content/renderer/p2p/ipc_socket_factory.h"
+#include "ppapi/c/pp_input_event.h"
#include "ppapi/cpp/completion_callback.h"
-#include "ppapi/cpp/input_event.h"
#include "ppapi/cpp/rect.h"
// TODO(wez): Remove this when crbug.com/86353 is complete.
#include "ppapi/cpp/private/var_private.h"
@@ -55,8 +55,6 @@ ChromotingInstance::ChromotingInstance(PP_Instance pp_instance)
: pp::InstancePrivate(pp_instance),
initialized_(false),
logger_(this) {
- RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
- RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);
}
ChromotingInstance::~ChromotingInstance() {
@@ -171,51 +169,44 @@ void ChromotingInstance::DidChangeView(const pp::Rect& position,
view_->SetScreenSize(clip.width(), clip.height());
}
-bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) {
+bool ChromotingInstance::HandleInputEvent(const PP_InputEvent& event) {
DCHECK(CurrentlyOnPluginThread());
PepperInputHandler* pih
= static_cast<PepperInputHandler*>(input_handler_.get());
- switch (event.GetType()) {
- case PP_INPUTEVENT_TYPE_MOUSEDOWN: {
- pih->HandleMouseButtonEvent(true, pp::MouseInputEvent(event));
+ switch (event.type) {
+ case PP_INPUTEVENT_TYPE_MOUSEDOWN:
+ pih->HandleMouseButtonEvent(true, event.u.mouse);
return true;
- }
- case PP_INPUTEVENT_TYPE_MOUSEUP: {
- pih->HandleMouseButtonEvent(false, pp::MouseInputEvent(event));
+ case PP_INPUTEVENT_TYPE_MOUSEUP:
+ pih->HandleMouseButtonEvent(false, event.u.mouse);
return true;
- }
case PP_INPUTEVENT_TYPE_MOUSEMOVE:
case PP_INPUTEVENT_TYPE_MOUSEENTER:
- case PP_INPUTEVENT_TYPE_MOUSELEAVE: {
- pih->HandleMouseMoveEvent(pp::MouseInputEvent(event));
+ case PP_INPUTEVENT_TYPE_MOUSELEAVE:
+ pih->HandleMouseMoveEvent(event.u.mouse);
return true;
- }
- case PP_INPUTEVENT_TYPE_CONTEXTMENU: {
+ case PP_INPUTEVENT_TYPE_CONTEXTMENU:
// We need to return true here or else we'll get a local (plugin) context
// menu instead of the mouseup event for the right click.
return true;
- }
case PP_INPUTEVENT_TYPE_KEYDOWN:
- case PP_INPUTEVENT_TYPE_KEYUP: {
- pp::KeyboardInputEvent key_event(event);
+ case PP_INPUTEVENT_TYPE_KEYUP:
logger_.VLog(3, "PP_INPUTEVENT_TYPE_KEY%s key=%d",
- (event.GetType()==PP_INPUTEVENT_TYPE_KEYDOWN ? "DOWN" : "UP"),
- key_event.GetKeyCode());
- pih->HandleKeyEvent(event.GetType() == PP_INPUTEVENT_TYPE_KEYDOWN,
- key_event);
+ (event.type==PP_INPUTEVENT_TYPE_KEYDOWN ? "DOWN" : "UP"),
+ event.u.key.key_code);
+ pih->HandleKeyEvent(event.type == PP_INPUTEVENT_TYPE_KEYDOWN,
+ event.u.key);
return true;
- }
- case PP_INPUTEVENT_TYPE_CHAR: {
- pih->HandleCharacterEvent(pp::KeyboardInputEvent(event));
+ case PP_INPUTEVENT_TYPE_CHAR:
+ pih->HandleCharacterEvent(event.u.character);
return true;
- }
default:
break;
diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h
index 6d999c7..d79254f 100644
--- a/remoting/client/plugin/chromoting_instance.h
+++ b/remoting/client/plugin/chromoting_instance.h
@@ -23,13 +23,13 @@
#include "remoting/protocol/connection_to_host.h"
class MessageLoop;
+struct PP_InputEvent;
namespace base {
class Thread;
} // namespace base
namespace pp {
-class InputEvent;
class Module;
} // namespace pp
@@ -64,7 +64,7 @@ class ChromotingInstance : public pp::InstancePrivate {
virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]);
virtual void Connect(const ClientConfig& config);
- virtual bool HandleInputEvent(const pp::InputEvent& event);
+ virtual bool HandleInputEvent(const PP_InputEvent& event);
virtual void Disconnect();
virtual pp::Var GetInstanceObject();
diff --git a/remoting/client/plugin/pepper_input_handler.cc b/remoting/client/plugin/pepper_input_handler.cc
index f94a402..452668e 100644
--- a/remoting/client/plugin/pepper_input_handler.cc
+++ b/remoting/client/plugin/pepper_input_handler.cc
@@ -5,15 +5,11 @@
#include "remoting/client/plugin/pepper_input_handler.h"
#include "ppapi/c/pp_input_event.h"
-#include "ppapi/cpp/input_event.h"
-#include "ppapi/cpp/point.h"
#include "remoting/client/chromoting_view.h"
#include "ui/gfx/point.h"
namespace remoting {
-using pp::KeyboardInputEvent;
-using pp::MouseInputEvent;
using protocol::KeyEvent;
using protocol::MouseEvent;
@@ -30,31 +26,33 @@ void PepperInputHandler::Initialize() {
}
void PepperInputHandler::HandleKeyEvent(bool keydown,
- const KeyboardInputEvent& event) {
- SendKeyEvent(keydown, event.GetKeyCode());
+ const PP_InputEvent_Key& event) {
+ SendKeyEvent(keydown, event.key_code);
}
-void PepperInputHandler::HandleCharacterEvent(const KeyboardInputEvent& event) {
+void PepperInputHandler::HandleCharacterEvent(
+ const PP_InputEvent_Character& event) {
// TODO(garykac): Coordinate key and char events.
}
-void PepperInputHandler::HandleMouseMoveEvent(const MouseInputEvent& event) {
- gfx::Point p(static_cast<int>(event.GetMousePosition().x()),
- static_cast<int>(event.GetMousePosition().y()));
+void PepperInputHandler::HandleMouseMoveEvent(
+ const PP_InputEvent_Mouse& event) {
+ gfx::Point p(static_cast<int>(event.x), static_cast<int>(event.y));
// Pepper gives co-ordinates in the plugin instance's co-ordinate system,
// which may be different from the host desktop's co-ordinate system.
p = view_->ConvertScreenToHost(p);
SendMouseMoveEvent(p.x(), p.y());
}
-void PepperInputHandler::HandleMouseButtonEvent(bool button_down,
- const MouseInputEvent& event) {
+void PepperInputHandler::HandleMouseButtonEvent(
+ bool button_down,
+ const PP_InputEvent_Mouse& event) {
MouseEvent::MouseButton button = MouseEvent::BUTTON_UNDEFINED;
- if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) {
+ if (event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) {
button = MouseEvent::BUTTON_LEFT;
- } else if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) {
+ } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_MIDDLE) {
button = MouseEvent::BUTTON_MIDDLE;
- } else if (event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) {
+ } else if (event.button == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) {
button = MouseEvent::BUTTON_RIGHT;
}
diff --git a/remoting/client/plugin/pepper_input_handler.h b/remoting/client/plugin/pepper_input_handler.h
index 5a19f88..b99dd32 100644
--- a/remoting/client/plugin/pepper_input_handler.h
+++ b/remoting/client/plugin/pepper_input_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -11,11 +11,6 @@ struct PP_InputEvent_Character;
struct PP_InputEvent_Key;
struct PP_InputEvent_Mouse;
-namespace pp {
-class KeyboardInputEvent;
-class MouseInputEvent;
-} // namespace pp
-
namespace remoting {
class PepperInputHandler : public InputHandler {
@@ -27,12 +22,12 @@ class PepperInputHandler : public InputHandler {
virtual void Initialize();
- void HandleKeyEvent(bool keydown, const pp::KeyboardInputEvent& event);
- void HandleCharacterEvent(const pp::KeyboardInputEvent& event);
+ void HandleKeyEvent(bool keydown, const PP_InputEvent_Key& event);
+ void HandleCharacterEvent(const PP_InputEvent_Character& event);
- void HandleMouseMoveEvent(const pp::MouseInputEvent& event);
+ void HandleMouseMoveEvent(const PP_InputEvent_Mouse& event);
void HandleMouseButtonEvent(bool button_down,
- const pp::MouseInputEvent& event);
+ const PP_InputEvent_Mouse& event);
private:
DISALLOW_COPY_AND_ASSIGN(PepperInputHandler);