Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/host/single_window_input_injector.h" | 5 #include "remoting/host/single_window_input_injector.h" |
| 6 | 6 |
| 7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
| 8 #include <Carbon/Carbon.h> | 8 #include <Carbon/Carbon.h> |
| 9 | 9 |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 scoped_ptr<InputInjector> input_injector); | 27 scoped_ptr<InputInjector> input_injector); |
| 28 ~SingleWindowInputInjectorMac() override; | 28 ~SingleWindowInputInjectorMac() override; |
| 29 | 29 |
| 30 // InputInjector interface. | 30 // InputInjector interface. |
| 31 void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override; | 31 void Start(scoped_ptr<protocol::ClipboardStub> client_clipboard) override; |
| 32 void InjectKeyEvent(const KeyEvent& event) override; | 32 void InjectKeyEvent(const KeyEvent& event) override; |
| 33 void InjectTextEvent(const TextEvent& event) override; | 33 void InjectTextEvent(const TextEvent& event) override; |
| 34 void InjectMouseEvent(const MouseEvent& event) override; | 34 void InjectMouseEvent(const MouseEvent& event) override; |
| 35 void InjectTouchEvent(const TouchEvent& event) override; | 35 void InjectTouchEvent(const TouchEvent& event) override; |
| 36 void InjectClipboardEvent(const ClipboardEvent& event) override; | 36 void InjectClipboardEvent(const ClipboardEvent& event) override; |
| 37 bool CanInjectTouch() override; | |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 CGRect FindCGRectOfWindow(); | 40 CGRect FindCGRectOfWindow(); |
| 40 | 41 |
| 41 CGWindowID window_id_; | 42 CGWindowID window_id_; |
| 42 scoped_ptr<InputInjector> input_injector_; | 43 scoped_ptr<InputInjector> input_injector_; |
| 43 | 44 |
| 44 DISALLOW_COPY_AND_ASSIGN(SingleWindowInputInjectorMac); | 45 DISALLOW_COPY_AND_ASSIGN(SingleWindowInputInjectorMac); |
| 45 }; | 46 }; |
| 46 | 47 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 | 112 |
| 112 void SingleWindowInputInjectorMac::InjectTouchEvent(const TouchEvent& event) { | 113 void SingleWindowInputInjectorMac::InjectTouchEvent(const TouchEvent& event) { |
| 113 NOTIMPLEMENTED(); | 114 NOTIMPLEMENTED(); |
| 114 } | 115 } |
| 115 | 116 |
| 116 void SingleWindowInputInjectorMac::InjectClipboardEvent( | 117 void SingleWindowInputInjectorMac::InjectClipboardEvent( |
| 117 const ClipboardEvent& event) { | 118 const ClipboardEvent& event) { |
| 118 input_injector_->InjectClipboardEvent(event); | 119 input_injector_->InjectClipboardEvent(event); |
| 119 } | 120 } |
| 120 | 121 |
| 122 bool SingleWindowInputInjectorMac::CanInjectTouch() { | |
| 123 return InputInjector::DefaultCanInjectTouch(); | |
|
Wez
2015/04/09 22:58:59
This is wrong; InjectTouchEvent() above is NOTIMPL
Rintaro Kuroiwa
2015/04/20 18:20:03
Reverted.
| |
| 124 } | |
| 125 | |
| 121 // This method finds the rectangle of the window we are streaming using | 126 // This method finds the rectangle of the window we are streaming using |
| 122 // |window_id_|. The InputInjector can then use this rectangle | 127 // |window_id_|. The InputInjector can then use this rectangle |
| 123 // to translate the input event to coordinates of the window rather | 128 // to translate the input event to coordinates of the window rather |
| 124 // than the screen. | 129 // than the screen. |
| 125 CGRect SingleWindowInputInjectorMac::FindCGRectOfWindow() { | 130 CGRect SingleWindowInputInjectorMac::FindCGRectOfWindow() { |
| 126 CGRect rect; | 131 CGRect rect; |
| 127 CGWindowID ids[1] = {window_id_}; | 132 CGWindowID ids[1] = {window_id_}; |
| 128 base::ScopedCFTypeRef<CFArrayRef> window_id_array( | 133 base::ScopedCFTypeRef<CFArrayRef> window_id_array( |
| 129 CFArrayCreate(nullptr, reinterpret_cast<const void**>(&ids), 1, nullptr)); | 134 CFArrayCreate(nullptr, reinterpret_cast<const void**>(&ids), 1, nullptr)); |
| 130 | 135 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 | 167 |
| 163 scoped_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow( | 168 scoped_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow( |
| 164 webrtc::WindowId window_id, | 169 webrtc::WindowId window_id, |
| 165 scoped_ptr<InputInjector> input_injector) { | 170 scoped_ptr<InputInjector> input_injector) { |
| 166 scoped_ptr<SingleWindowInputInjectorMac> injector( | 171 scoped_ptr<SingleWindowInputInjectorMac> injector( |
| 167 new SingleWindowInputInjectorMac(window_id, input_injector.Pass())); | 172 new SingleWindowInputInjectorMac(window_id, input_injector.Pass())); |
| 168 return injector.Pass(); | 173 return injector.Pass(); |
| 169 } | 174 } |
| 170 | 175 |
| 171 } // namespace remoting | 176 } // namespace remoting |
| OLD | NEW |