1 /* 2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef WEBRTC_BASE_WINDOWPICKERFACTORY_H_ 12 #define WEBRTC_BASE_WINDOWPICKERFACTORY_H_ 13 14 #if defined(WEBRTC_WIN) 15 #include "webrtc/base/win32windowpicker.h" 16 #elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) 17 #include "webrtc/base/macutils.h" 18 #include "webrtc/base/macwindowpicker.h" 19 #elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) && defined(HAVE_X11) 20 #include "webrtc/base/x11windowpicker.h" 21 #endif 22 23 #include "webrtc/base/windowpicker.h" 24 25 namespace rtc { 26 27 class WindowPickerFactory { 28 public: 29 virtual ~WindowPickerFactory() {} 30 31 // Instance method for dependency injection. 32 virtual WindowPicker* Create() { 33 return CreateWindowPicker(); 34 } 35 36 static WindowPicker* CreateWindowPicker() { 37 #if defined(WEBRTC_WIN) 38 return new Win32WindowPicker(); 39 #elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) 40 return new MacWindowPicker(); 41 #elif defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) && defined(HAVE_X11) 42 return new X11WindowPicker(); 43 #else 44 return NULL; 45 #endif 46 } 47 48 static bool IsSupported() { 49 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) 50 return GetOSVersionName() >= kMacOSLeopard; 51 #else 52 return true; 53 #endif 54 } 55 }; 56 57 } // namespace rtc 58 59 #endif // WEBRTC_BASE_WINDOWPICKERFACTORY_H_ 60