Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: webkit/tools/pepper_test_plugin/event_handler.cc

Issue 524051: Revert 35649 - Make Pepper plugins work on Linux.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/webplugin_delegate_pepper.cc ('k') | webkit/tools/pepper_test_plugin/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/pepper_test_plugin/event_handler.cc
===================================================================
--- webkit/tools/pepper_test_plugin/event_handler.cc (revision 35652)
+++ webkit/tools/pepper_test_plugin/event_handler.cc (working copy)
@@ -26,8 +26,11 @@
#include "webkit/tools/pepper_test_plugin/event_handler.h"
#include <stdio.h>
-#include <sstream>
+#include <string>
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "base/string_util.h"
#include "webkit/tools/pepper_test_plugin/plugin_object.h"
EventHandler* event_handler = NULL;
@@ -55,10 +58,7 @@
}
std::string EventHandler::EventName(double timestamp, int32 type) {
- std::stringstream strstr;
- strstr.setf(std::ios::fixed, std::ios::floatfield);
- strstr << timestamp << ": ";
- std::string str(strstr.str());
+ std::string str = DoubleToString(timestamp) + ": ";
switch (type) {
case NPEventType_MouseDown:
return str + "MouseDown";
@@ -94,43 +94,46 @@
int EventHandler::handle(void* event) {
NPPepperEvent* npevent = reinterpret_cast<NPPepperEvent*>(event);
- std::stringstream str;
- str << EventName(npevent->timeStampSeconds, npevent->type);
+ std::string str = EventName(npevent->timeStampSeconds, npevent->type);
switch (npevent->type) {
case NPEventType_MouseDown:
case NPEventType_MouseUp:
case NPEventType_MouseMove:
case NPEventType_MouseEnter:
case NPEventType_MouseLeave:
- str << ": mod " << npevent->u.mouse.modifier
- << ", but: " << npevent->u.mouse.button
- << ", x: " << npevent->u.mouse.x
- << ", y: " << npevent->u.mouse.y
- << ", click: " << npevent->u.mouse.clickCount;
+ str += StringPrintf(": mod %x, but: %x, x: %d, y: %d, click: %d",
+ npevent->u.mouse.modifier,
+ npevent->u.mouse.button,
+ npevent->u.mouse.x,
+ npevent->u.mouse.y,
+ npevent->u.mouse.clickCount);
break;
case NPEventType_MouseWheel:
- str << ": mod " << npevent->u.wheel.modifier
- << ", dx: " << npevent->u.wheel.deltaX
- << ", dy: " << npevent->u.wheel.deltaY
- << ", wtx: " << npevent->u.wheel.wheelTicksX
- << ", wty: " << npevent->u.wheel.wheelTicksY
- << ", sbp:" << npevent->u.wheel.scrollByPage;
+ str += StringPrintf(": mod %x, dx: %f, dy: %f, wtx: %f, wty: %d: sbp %d",
+ npevent->u.wheel.modifier,
+ npevent->u.wheel.deltaX,
+ npevent->u.wheel.deltaY,
+ npevent->u.wheel.wheelTicksX,
+ npevent->u.wheel.wheelTicksY,
+ npevent->u.wheel.scrollByPage);
break;
case NPEventType_RawKeyDown:
case NPEventType_KeyDown:
case NPEventType_KeyUp:
- str << ": mod " << npevent->u.key.modifier
- << ", key: " << npevent->u.key.normalizedKeyCode;
+ str += StringPrintf(": mod %x, key: %x",
+ npevent->u.key.modifier,
+ npevent->u.key.normalizedKeyCode);
break;
case NPEventType_Char:
- str << ": mod " << npevent->u.character.modifier << ", text: ";
+ str += StringPrintf(": mod %x, text: ",
+ npevent->u.character.modifier);
size_t i;
for (i = 0; i < arraysize(npevent->u.character.text); ++i) {
- str << npevent->u.character.text[i] << ' ';
+ str += StringPrintf("%x ", npevent->u.character.text[i]);
}
- str << ", unmod: ";
+ str += ", unmod: ";
for (i = 0; i < arraysize(npevent->u.character.unmodifiedText); ++i) {
- str << npevent->u.character.unmodifiedText[i] << ' ';
+ str += StringPrintf("%x ", npevent->u.character.unmodifiedText[i]);
}
break;
case NPEventType_Minimize:
@@ -141,7 +144,7 @@
default:
break;
}
- addText(str.str().c_str());
+ addText(str.c_str());
return 0;
}
« no previous file with comments | « chrome/renderer/webplugin_delegate_pepper.cc ('k') | webkit/tools/pepper_test_plugin/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698