| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 view_->Paint(); | 108 view_->Paint(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool ChromotingInstance::CurrentlyOnPluginThread() const { | 111 bool ChromotingInstance::CurrentlyOnPluginThread() const { |
| 112 return pepper_main_loop_dont_post_to_me_ == MessageLoop::current(); | 112 return pepper_main_loop_dont_post_to_me_ == MessageLoop::current(); |
| 113 } | 113 } |
| 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 |
| 119 = static_cast<PepperInputHandler*>(input_handler_.get()); |
| 120 |
| 118 switch (event.type) { | 121 switch (event.type) { |
| 119 case PP_EVENT_TYPE_MOUSEDOWN: | 122 case PP_EVENT_TYPE_MOUSEDOWN: |
| 123 pih->HandleMouseButtonEvent(true, event.u.mouse); |
| 124 break; |
| 120 case PP_EVENT_TYPE_MOUSEUP: | 125 case PP_EVENT_TYPE_MOUSEUP: |
| 126 pih->HandleMouseButtonEvent(false, event.u.mouse); |
| 127 break; |
| 121 case PP_EVENT_TYPE_MOUSEMOVE: | 128 case PP_EVENT_TYPE_MOUSEMOVE: |
| 122 case PP_EVENT_TYPE_MOUSEENTER: | 129 case PP_EVENT_TYPE_MOUSEENTER: |
| 123 case PP_EVENT_TYPE_MOUSELEAVE: | 130 case PP_EVENT_TYPE_MOUSELEAVE: |
| 124 // client_->handle_mouse_event(npevent); | 131 pih->HandleMouseMoveEvent(event.u.mouse); |
| 125 break; | 132 break; |
| 126 | 133 |
| 134 case PP_EVENT_TYPE_KEYDOWN: |
| 127 case PP_EVENT_TYPE_CHAR: | 135 case PP_EVENT_TYPE_CHAR: |
| 128 // client_->handle_char_event(npevent); | 136 // client_->handle_char_event(npevent); |
| 129 break; | 137 break; |
| 130 | 138 |
| 131 default: | 139 default: |
| 132 break; | 140 break; |
| 133 } | 141 } |
| 134 | 142 |
| 135 return false; | 143 return false; |
| 136 } | 144 } |
| 137 | 145 |
| 138 pp::Var ChromotingInstance::GetInstanceObject() { | 146 pp::Var ChromotingInstance::GetInstanceObject() { |
| 139 LOG(ERROR) << "Getting instance object."; | 147 LOG(ERROR) << "Getting instance object."; |
| 140 if (instance_object_.is_void()) { | 148 if (instance_object_.is_void()) { |
| 141 ChromotingScriptableObject* object = new ChromotingScriptableObject(this); | 149 ChromotingScriptableObject* object = new ChromotingScriptableObject(this); |
| 142 object->Init(); | 150 object->Init(); |
| 143 | 151 |
| 144 LOG(ERROR) << "Object initted."; | 152 LOG(ERROR) << "Object initted."; |
| 145 // The pp::Var takes ownership of object here. | 153 // The pp::Var takes ownership of object here. |
| 146 instance_object_ = pp::Var(object); | 154 instance_object_ = pp::Var(object); |
| 147 } | 155 } |
| 148 | 156 |
| 149 return instance_object_; | 157 return instance_object_; |
| 150 } | 158 } |
| 151 | 159 |
| 152 } // namespace remoting | 160 } // namespace remoting |
| OLD | NEW |