OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/event_executor.h" | 5 #include "remoting/host/event_executor.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/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/mac/scoped_cftyperef.h" | 14 #include "base/mac/scoped_cftyperef.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
17 #include "remoting/capturer/mac/desktop_configuration.h" | 17 #include "media/video/capture/screen/mac/desktop_configuration.h" |
18 #include "remoting/host/clipboard.h" | 18 #include "remoting/host/clipboard.h" |
19 #include "remoting/proto/internal.pb.h" | 19 #include "remoting/proto/internal.pb.h" |
20 #include "remoting/protocol/message_decoder.h" | 20 #include "remoting/protocol/message_decoder.h" |
21 #include "skia/ext/skia_utils_mac.h" | 21 #include "skia/ext/skia_utils_mac.h" |
22 #include "third_party/skia/include/core/SkPoint.h" | 22 #include "third_party/skia/include/core/SkPoint.h" |
23 #include "third_party/skia/include/core/SkRect.h" | 23 #include "third_party/skia/include/core/SkRect.h" |
24 | 24 |
25 namespace remoting { | 25 namespace remoting { |
26 | 26 |
27 namespace { | 27 namespace { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // here and in the Capturer. | 185 // here and in the Capturer. |
186 | 186 |
187 // Set the mouse position assuming single-monitor. | 187 // Set the mouse position assuming single-monitor. |
188 mouse_pos_ = SkIPoint::Make(event.x(), event.y()); | 188 mouse_pos_ = SkIPoint::Make(event.x(), event.y()); |
189 | 189 |
190 // Fetch the desktop configuration. | 190 // Fetch the desktop configuration. |
191 // TODO(wez): Optimize this out, or at least only enumerate displays in | 191 // TODO(wez): Optimize this out, or at least only enumerate displays in |
192 // response to display-changed events. VideoFrameCapturer's VideoFrames | 192 // response to display-changed events. VideoFrameCapturer's VideoFrames |
193 // could be augmented to include native cursor coordinates for use by | 193 // could be augmented to include native cursor coordinates for use by |
194 // MouseClampingFilter, removing the need for translation here. | 194 // MouseClampingFilter, removing the need for translation here. |
195 MacDesktopConfiguration desktop_config | 195 media::MacDesktopConfiguration desktop_config = |
196 = MacDesktopConfiguration::GetCurrent(); | 196 media::MacDesktopConfiguration::GetCurrent(); |
197 | 197 |
198 // Translate the mouse position into desktop coordinates. | 198 // Translate the mouse position into desktop coordinates. |
199 mouse_pos_ += SkIPoint::Make(desktop_config.pixel_bounds.left(), | 199 mouse_pos_ += SkIPoint::Make(desktop_config.pixel_bounds.left(), |
200 desktop_config.pixel_bounds.top()); | 200 desktop_config.pixel_bounds.top()); |
201 | 201 |
202 // Convert from pixel to Density Independent Pixel coordinates. | 202 // Convert from pixel to Density Independent Pixel coordinates. |
203 mouse_pos_ = SkIPoint::Make( | 203 mouse_pos_ = SkIPoint::Make( |
204 SkScalarRound(mouse_pos_.x() / desktop_config.dip_to_pixel_scale), | 204 SkScalarRound(mouse_pos_.x() / desktop_config.dip_to_pixel_scale), |
205 SkScalarRound(mouse_pos_.y() / desktop_config.dip_to_pixel_scale)); | 205 SkScalarRound(mouse_pos_.y() / desktop_config.dip_to_pixel_scale)); |
206 | 206 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 279 |
280 } // namespace | 280 } // namespace |
281 | 281 |
282 scoped_ptr<EventExecutor> EventExecutor::Create( | 282 scoped_ptr<EventExecutor> EventExecutor::Create( |
283 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 283 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
284 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { | 284 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { |
285 return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner)); | 285 return scoped_ptr<EventExecutor>(new EventExecutorMac(main_task_runner)); |
286 } | 286 } |
287 | 287 |
288 } // namespace remoting | 288 } // namespace remoting |
OLD | NEW |