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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 | 114 |
115 // This method finds the rectangle of the window we are streaming using | 115 // This method finds the rectangle of the window we are streaming using |
116 // |window_id_|. The InputInjector can then use this rectangle | 116 // |window_id_|. The InputInjector can then use this rectangle |
117 // to translate the input event to coordinates of the window rather | 117 // to translate the input event to coordinates of the window rather |
118 // than the screen. | 118 // than the screen. |
119 CGRect SingleWindowInputInjectorMac::FindCGRectOfWindow() { | 119 CGRect SingleWindowInputInjectorMac::FindCGRectOfWindow() { |
120 CGRect rect; | 120 CGRect rect; |
121 CGWindowID ids[1] = {window_id_}; | 121 CGWindowID ids[1] = {window_id_}; |
122 base::ScopedCFTypeRef<CFArrayRef> window_id_array( | 122 base::ScopedCFTypeRef<CFArrayRef> window_id_array( |
123 CFArrayCreate(NULL, reinterpret_cast<const void **>(&ids), 1, NULL)); | 123 CFArrayCreate(nullptr, reinterpret_cast<const void**>(&ids), 1, nullptr)); |
124 | 124 |
125 base::ScopedCFTypeRef<CFArrayRef> window_array( | 125 base::ScopedCFTypeRef<CFArrayRef> window_array( |
126 CGWindowListCreateDescriptionFromArray(window_id_array)); | 126 CGWindowListCreateDescriptionFromArray(window_id_array)); |
127 | 127 |
128 if (window_array == NULL || CFArrayGetCount(window_array) == 0) { | 128 if (window_array == nullptr || CFArrayGetCount(window_array) == 0) { |
129 // Could not find the window. It might have been closed. | 129 // Could not find the window. It might have been closed. |
130 LOG(ERROR) << "Specified window to stream not found for id: " | 130 LOG(ERROR) << "Specified window to stream not found for id: " |
131 << window_id_; | 131 << window_id_; |
132 return CGRectNull; | 132 return CGRectNull; |
133 } | 133 } |
134 | 134 |
135 // We don't use ScopedCFTypeRef for |window_array| because the | 135 // We don't use ScopedCFTypeRef for |window_array| because the |
136 // CFDictionaryRef returned by CFArrayGetValueAtIndex is owned by | 136 // CFDictionaryRef returned by CFArrayGetValueAtIndex is owned by |
137 // window_array. The same is true of the |bounds|. | 137 // window_array. The same is true of the |bounds|. |
138 CFDictionaryRef window = | 138 CFDictionaryRef window = |
(...skipping 17 matching lines...) Expand all Loading... |
156 | 156 |
157 scoped_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow( | 157 scoped_ptr<InputInjector> SingleWindowInputInjector::CreateForWindow( |
158 webrtc::WindowId window_id, | 158 webrtc::WindowId window_id, |
159 scoped_ptr<InputInjector> input_injector) { | 159 scoped_ptr<InputInjector> input_injector) { |
160 scoped_ptr<SingleWindowInputInjectorMac> injector( | 160 scoped_ptr<SingleWindowInputInjectorMac> injector( |
161 new SingleWindowInputInjectorMac(window_id, input_injector.Pass())); | 161 new SingleWindowInputInjectorMac(window_id, input_injector.Pass())); |
162 return injector.Pass(); | 162 return injector.Pass(); |
163 } | 163 } |
164 | 164 |
165 } // namespace remoting | 165 } // namespace remoting |
OLD | NEW |