OLD | NEW |
1 // Copyright (c) 2010 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 "remoting/client/plugin/chromoting_instance.h" | 5 #include "remoting/client/plugin/chromoting_instance.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 bool ChromotingInstance::HandleEvent(const PP_Event& event) { | 115 bool ChromotingInstance::HandleEvent(const PP_Event& event) { |
116 DCHECK(CurrentlyOnPluginThread()); | 116 DCHECK(CurrentlyOnPluginThread()); |
117 | 117 |
118 PepperInputHandler* pih | 118 PepperInputHandler* pih |
119 = static_cast<PepperInputHandler*>(input_handler_.get()); | 119 = static_cast<PepperInputHandler*>(input_handler_.get()); |
120 | 120 |
121 switch (event.type) { | 121 switch (event.type) { |
122 case PP_EVENT_TYPE_MOUSEDOWN: | 122 case PP_EVENT_TYPE_MOUSEDOWN: |
123 pih->HandleMouseButtonEvent(true, event.u.mouse); | 123 pih->HandleMouseButtonEvent(true, event.u.mouse); |
124 break; | 124 return true; |
| 125 |
125 case PP_EVENT_TYPE_MOUSEUP: | 126 case PP_EVENT_TYPE_MOUSEUP: |
126 pih->HandleMouseButtonEvent(false, event.u.mouse); | 127 pih->HandleMouseButtonEvent(false, event.u.mouse); |
127 break; | 128 return true; |
| 129 |
128 case PP_EVENT_TYPE_MOUSEMOVE: | 130 case PP_EVENT_TYPE_MOUSEMOVE: |
129 case PP_EVENT_TYPE_MOUSEENTER: | 131 case PP_EVENT_TYPE_MOUSEENTER: |
130 case PP_EVENT_TYPE_MOUSELEAVE: | 132 case PP_EVENT_TYPE_MOUSELEAVE: |
131 pih->HandleMouseMoveEvent(event.u.mouse); | 133 pih->HandleMouseMoveEvent(event.u.mouse); |
132 break; | 134 return true; |
133 | 135 |
134 case PP_EVENT_TYPE_KEYDOWN: | 136 case PP_EVENT_TYPE_KEYDOWN: |
| 137 case PP_EVENT_TYPE_KEYUP: |
| 138 pih->HandleKeyEvent(event.type == PP_EVENT_TYPE_KEYDOWN, event.u.key); |
| 139 return true; |
| 140 |
135 case PP_EVENT_TYPE_CHAR: | 141 case PP_EVENT_TYPE_CHAR: |
136 // client_->handle_char_event(npevent); | 142 pih->HandleCharacterEvent(event.u.character); |
137 break; | 143 return true; |
138 | 144 |
139 default: | 145 default: |
140 break; | 146 break; |
141 } | 147 } |
142 | 148 |
143 return false; | 149 return false; |
144 } | 150 } |
145 | 151 |
146 pp::Var ChromotingInstance::GetInstanceObject() { | 152 pp::Var ChromotingInstance::GetInstanceObject() { |
147 LOG(ERROR) << "Getting instance object."; | 153 LOG(ERROR) << "Getting instance object."; |
148 if (instance_object_.is_void()) { | 154 if (instance_object_.is_void()) { |
149 ChromotingScriptableObject* object = new ChromotingScriptableObject(this); | 155 ChromotingScriptableObject* object = new ChromotingScriptableObject(this); |
150 object->Init(); | 156 object->Init(); |
151 | 157 |
152 LOG(ERROR) << "Object initted."; | 158 LOG(ERROR) << "Object initted."; |
153 // The pp::Var takes ownership of object here. | 159 // The pp::Var takes ownership of object here. |
154 instance_object_ = pp::Var(object); | 160 instance_object_ = pp::Var(object); |
155 } | 161 } |
156 | 162 |
157 return instance_object_; | 163 return instance_object_; |
158 } | 164 } |
159 | 165 |
160 } // namespace remoting | 166 } // namespace remoting |
OLD | NEW |