| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/proxy/ppb_input_event_proxy.h" | 5 #include "ppapi/proxy/ppb_input_event_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/c/ppb_audio_config.h" | 7 #include "ppapi/c/ppb_audio_config.h" |
| 8 #include "ppapi/proxy/plugin_dispatcher.h" | 8 #include "ppapi/proxy/plugin_dispatcher.h" |
| 9 #include "ppapi/proxy/plugin_resource.h" | |
| 10 #include "ppapi/proxy/plugin_var_tracker.h" | 9 #include "ppapi/proxy/plugin_var_tracker.h" |
| 11 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| 12 #include "ppapi/shared_impl/input_event_impl.h" | 11 #include "ppapi/shared_impl/input_event_impl.h" |
| 12 #include "ppapi/shared_impl/resource.h" |
| 13 #include "ppapi/shared_impl/var.h" | 13 #include "ppapi/shared_impl/var.h" |
| 14 #include "ppapi/thunk/thunk.h" | 14 #include "ppapi/thunk/thunk.h" |
| 15 | 15 |
| 16 using ppapi::HostResource; | 16 using ppapi::HostResource; |
| 17 using ppapi::InputEventData; | 17 using ppapi::InputEventData; |
| 18 using ppapi::InputEventImpl; | 18 using ppapi::InputEventImpl; |
| 19 using ppapi::Resource; |
| 19 using ppapi::thunk::PPB_InputEvent_API; | 20 using ppapi::thunk::PPB_InputEvent_API; |
| 20 | 21 |
| 21 namespace pp { | 22 namespace pp { |
| 22 namespace proxy { | 23 namespace proxy { |
| 23 | 24 |
| 24 // The implementation is actually in InputEventImpl. | 25 // The implementation is actually in InputEventImpl. |
| 25 class InputEvent : public PluginResource, public InputEventImpl { | 26 class InputEvent : public Resource, public InputEventImpl { |
| 26 public: | 27 public: |
| 27 InputEvent(const HostResource& resource, const InputEventData& data); | 28 InputEvent(const HostResource& resource, const InputEventData& data); |
| 28 virtual ~InputEvent(); | 29 virtual ~InputEvent(); |
| 29 | 30 |
| 30 // ResourceObjectBase overrides. | 31 // Resource overrides. |
| 31 virtual PPB_InputEvent_API* AsPPB_InputEvent_API() OVERRIDE; | 32 virtual PPB_InputEvent_API* AsPPB_InputEvent_API() OVERRIDE; |
| 32 | 33 |
| 33 // InputEventImpl overrides. | 34 // InputEventImpl overrides. |
| 34 virtual PP_Var StringToPPVar(const std::string& str) OVERRIDE; | 35 virtual PP_Var StringToPPVar(const std::string& str) OVERRIDE; |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 DISALLOW_COPY_AND_ASSIGN(InputEvent); | 38 DISALLOW_COPY_AND_ASSIGN(InputEvent); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 InputEvent::InputEvent(const HostResource& resource, const InputEventData& data) | 41 InputEvent::InputEvent(const HostResource& resource, const InputEventData& data) |
| 41 : PluginResource(resource), | 42 : Resource(resource), |
| 42 InputEventImpl(data) { | 43 InputEventImpl(data) { |
| 43 } | 44 } |
| 44 | 45 |
| 45 InputEvent::~InputEvent() { | 46 InputEvent::~InputEvent() { |
| 46 } | 47 } |
| 47 | 48 |
| 48 PPB_InputEvent_API* InputEvent::AsPPB_InputEvent_API() { | 49 PPB_InputEvent_API* InputEvent::AsPPB_InputEvent_API() { |
| 49 return this; | 50 return this; |
| 50 } | 51 } |
| 51 | 52 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 false, | 116 false, |
| 116 &CreateInputEventProxy, | 117 &CreateInputEventProxy, |
| 117 }; | 118 }; |
| 118 return &info; | 119 return &info; |
| 119 } | 120 } |
| 120 | 121 |
| 121 // static | 122 // static |
| 122 PP_Resource PPB_InputEvent_Proxy::CreateProxyResource( | 123 PP_Resource PPB_InputEvent_Proxy::CreateProxyResource( |
| 123 PP_Instance instance, | 124 PP_Instance instance, |
| 124 const InputEventData& data) { | 125 const InputEventData& data) { |
| 125 return PluginResourceTracker::GetInstance()->AddResource( | 126 return (new InputEvent(HostResource::MakeInstanceOnly(instance), data))-> |
| 126 new InputEvent(HostResource::MakeInstanceOnly(instance), data)); | 127 GetReference(); |
| 127 } | 128 } |
| 128 | 129 |
| 129 bool PPB_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) { | 130 bool PPB_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 130 // There are no IPC messages for this interface. | 131 // There are no IPC messages for this interface. |
| 131 NOTREACHED(); | 132 NOTREACHED(); |
| 132 return false; | 133 return false; |
| 133 } | 134 } |
| 134 | 135 |
| 135 } // namespace proxy | 136 } // namespace proxy |
| 136 } // namespace pp | 137 } // namespace pp |
| OLD | NEW |