| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2010 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 #include "webrtc/base/win32windowpicker.h" | 10 #include "webrtc/base/win32windowpicker.h" |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "webrtc/base/arraysize.h" |
| 15 #include "webrtc/base/common.h" | 16 #include "webrtc/base/common.h" |
| 16 #include "webrtc/base/logging.h" | 17 #include "webrtc/base/logging.h" |
| 17 | 18 |
| 18 namespace rtc { | 19 namespace rtc { |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 // Window class names that we want to filter out. | 23 // Window class names that we want to filter out. |
| 23 const char kProgramManagerClass[] = "Progman"; | 24 const char kProgramManagerClass[] = "Progman"; |
| 24 const char kButtonClass[] = "Button"; | 25 const char kButtonClass[] = "Button"; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 51 // Skip the Program Manager window and the Start button. | 52 // Skip the Program Manager window and the Start button. |
| 52 TCHAR class_name_w[500]; | 53 TCHAR class_name_w[500]; |
| 53 ::GetClassName(hwnd, class_name_w, 500); | 54 ::GetClassName(hwnd, class_name_w, 500); |
| 54 std::string class_name = ToUtf8(class_name_w); | 55 std::string class_name = ToUtf8(class_name_w); |
| 55 if (class_name == kProgramManagerClass || class_name == kButtonClass) { | 56 if (class_name == kProgramManagerClass || class_name == kButtonClass) { |
| 56 // We don't want the Program Manager window nor the Start button. | 57 // We don't want the Program Manager window nor the Start button. |
| 57 return TRUE; | 58 return TRUE; |
| 58 } | 59 } |
| 59 | 60 |
| 60 TCHAR window_title[500]; | 61 TCHAR window_title[500]; |
| 61 GetWindowText(hwnd, window_title, ARRAY_SIZE(window_title)); | 62 GetWindowText(hwnd, window_title, arraysize(window_title)); |
| 62 std::string title = ToUtf8(window_title); | 63 std::string title = ToUtf8(window_title); |
| 63 | 64 |
| 64 WindowId id(hwnd); | 65 WindowId id(hwnd); |
| 65 WindowDescription desc(id, title); | 66 WindowDescription desc(id, title); |
| 66 descriptions->push_back(desc); | 67 descriptions->push_back(desc); |
| 67 return TRUE; | 68 return TRUE; |
| 68 } | 69 } |
| 69 | 70 |
| 70 BOOL CALLBACK Win32WindowPicker::MonitorEnumProc(HMONITOR h_monitor, | 71 BOOL CALLBACK Win32WindowPicker::MonitorEnumProc(HMONITOR h_monitor, |
| 71 HDC hdc_monitor, | 72 HDC hdc_monitor, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 135 |
| 135 bool Win32WindowPicker::IsVisible(const WindowId& id) { | 136 bool Win32WindowPicker::IsVisible(const WindowId& id) { |
| 136 return (::IsWindow(id.id()) != FALSE && ::IsWindowVisible(id.id()) != FALSE); | 137 return (::IsWindow(id.id()) != FALSE && ::IsWindowVisible(id.id()) != FALSE); |
| 137 } | 138 } |
| 138 | 139 |
| 139 bool Win32WindowPicker::MoveToFront(const WindowId& id) { | 140 bool Win32WindowPicker::MoveToFront(const WindowId& id) { |
| 140 return SetForegroundWindow(id.id()) != FALSE; | 141 return SetForegroundWindow(id.id()) != FALSE; |
| 141 } | 142 } |
| 142 | 143 |
| 143 } // namespace rtc | 144 } // namespace rtc |
| OLD | NEW |