Chromium Code Reviews| Index: ppapi/examples/2d/paint_manager_example.cc |
| diff --git a/ppapi/examples/2d/paint_manager_example.cc b/ppapi/examples/2d/paint_manager_example.cc |
| index 86bdbe79ed8f9f2a8e820cd682f24c57cbb413d7..f85a2c24125c2e2d84a13ff9a454f2763d1ec4eb 100644 |
| --- a/ppapi/examples/2d/paint_manager_example.cc |
| +++ b/ppapi/examples/2d/paint_manager_example.cc |
| @@ -8,8 +8,10 @@ |
| #include "ppapi/cpp/input_event.h" |
| #include "ppapi/cpp/instance.h" |
| #include "ppapi/cpp/module.h" |
| +#include "ppapi/cpp/private/flash_device_id.h" |
|
yzshen1
2012/09/11 00:53:17
I think you are not going to commit this file, rig
|
| #include "ppapi/cpp/size.h" |
| #include "ppapi/cpp/view.h" |
| +#include "ppapi/utility/completion_callback_factory.h" |
| #include "ppapi/utility/graphics/paint_manager.h" |
| // Number of pixels to each side of the center of the square that we draw. |
| @@ -42,13 +44,27 @@ class MyInstance : public pp::Instance, public pp::PaintManager::Client { |
| paint_manager_(), |
| last_x_(0), |
| last_y_(0) { |
| + factory_.Initialize(this); |
| + device_id_ = pp::flash::DeviceID(this); |
| + |
| paint_manager_.Initialize(this, this, false); |
| RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE); |
| } |
| + pp::CompletionCallbackFactory<MyInstance> factory_; |
| + pp::flash::DeviceID device_id_; |
| + |
| + void GotDeviceID(int32_t result, const pp::Var& id) { |
| + std::string value = id.AsString(); |
| + value.append(""); |
| + } |
| + |
| virtual bool HandleInputEvent(const pp::InputEvent& event) { |
| switch (event.GetType()) { |
| case PP_INPUTEVENT_TYPE_MOUSEDOWN: { |
| + device_id_.GetDeviceID(factory_.NewCallbackWithOutput( |
| + &MyInstance::GotDeviceID)); |
| + |
| pp::MouseInputEvent mouse_event(event); |
| // Update the square on a mouse down. |
| if (mouse_event.GetButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) { |