| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/c/dev/ppb_file_chooser_dev.h" | 5 #include "ppapi/c/dev/ppb_file_chooser_dev.h" |
| 6 #include "ppapi/c/pp_input_event.h" | 6 #include "ppapi/c/pp_input_event.h" |
| 7 #include "ppapi/cpp/completion_callback.h" | 7 #include "ppapi/cpp/completion_callback.h" |
| 8 #include "ppapi/cpp/dev/file_chooser_dev.h" | 8 #include "ppapi/cpp/dev/file_chooser_dev.h" |
| 9 #include "ppapi/cpp/file_ref.h" | 9 #include "ppapi/cpp/file_ref.h" |
| 10 #include "ppapi/cpp/input_event.h" | |
| 11 #include "ppapi/cpp/module.h" | 10 #include "ppapi/cpp/module.h" |
| 12 #include "ppapi/cpp/private/instance_private.h" | 11 #include "ppapi/cpp/private/instance_private.h" |
| 13 #include "ppapi/cpp/private/var_private.h" | 12 #include "ppapi/cpp/private/var_private.h" |
| 14 | 13 |
| 15 class MyInstance : public pp::InstancePrivate { | 14 class MyInstance : public pp::InstancePrivate { |
| 16 public: | 15 public: |
| 17 MyInstance(PP_Instance instance) | 16 MyInstance(PP_Instance instance) |
| 18 : pp::InstancePrivate(instance) { | 17 : pp::InstancePrivate(instance) { |
| 19 callback_factory_.Initialize(this); | 18 callback_factory_.Initialize(this); |
| 20 RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE); | |
| 21 } | 19 } |
| 22 | 20 |
| 23 virtual bool HandleInputEvent(const pp::InputEvent& event) { | 21 virtual bool HandleInputEvent(const PP_InputEvent& event) { |
| 24 switch (event.GetType()) { | 22 switch (event.type) { |
| 25 case PP_INPUTEVENT_TYPE_MOUSEDOWN: { | 23 case PP_INPUTEVENT_TYPE_MOUSEDOWN: { |
| 26 pp::MouseInputEvent mouse_event(event); | 24 const PP_InputEvent_Mouse& mouse_event = event.u.mouse; |
| 27 if (mouse_event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT) | 25 if (mouse_event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) |
| 28 ShowFileChooser(false); | 26 ShowFileChooser(false); |
| 29 else if (mouse_event.GetMouseButton() | 27 else if (mouse_event.button == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) |
| 30 == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) | |
| 31 ShowFileChooser(true); | 28 ShowFileChooser(true); |
| 32 else | 29 else |
| 33 return false; | 30 return false; |
| 34 | 31 |
| 35 return true; | 32 return true; |
| 36 } | 33 } |
| 37 default: | 34 default: |
| 38 return false; | 35 return false; |
| 39 } | 36 } |
| 40 } | 37 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 }; | 98 }; |
| 102 | 99 |
| 103 namespace pp { | 100 namespace pp { |
| 104 | 101 |
| 105 // Factory function for your specialization of the Module object. | 102 // Factory function for your specialization of the Module object. |
| 106 Module* CreateModule() { | 103 Module* CreateModule() { |
| 107 return new MyModule(); | 104 return new MyModule(); |
| 108 } | 105 } |
| 109 | 106 |
| 110 } // namespace pp | 107 } // namespace pp |
| OLD | NEW |