| 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 "content/browser/system_message_window_win.h" | 5 #include "content/browser/system_message_window_win.h" |
| 6 | 6 |
| 7 #include <dbt.h> | 7 #include <dbt.h> |
| 8 #include <ks.h> | 8 #include <ks.h> |
| 9 #include <ksmedia.h> | 9 #include <ksmedia.h> |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 case DBT_DEVICEREMOVECOMPLETE: | 105 case DBT_DEVICEREMOVECOMPLETE: |
| 106 case DBT_DEVICEARRIVAL: { | 106 case DBT_DEVICEARRIVAL: { |
| 107 // This notification has more details about the specific device that | 107 // This notification has more details about the specific device that |
| 108 // was added or removed. See if this is a category we're interested | 108 // was added or removed. See if this is a category we're interested |
| 109 // in monitoring and if so report the specific device type. If we don't | 109 // in monitoring and if so report the specific device type. If we don't |
| 110 // find the category in our map, ignore the notification and do not | 110 // find the category in our map, ignore the notification and do not |
| 111 // notify the system monitor. | 111 // notify the system monitor. |
| 112 DEV_BROADCAST_DEVICEINTERFACE* device_interface = | 112 DEV_BROADCAST_DEVICEINTERFACE* device_interface = |
| 113 reinterpret_cast<DEV_BROADCAST_DEVICEINTERFACE*>(data); | 113 reinterpret_cast<DEV_BROADCAST_DEVICEINTERFACE*>(data); |
| 114 DCHECK_EQ(device_interface->dbcc_devicetype, | 114 if (device_interface->dbcc_devicetype != DBT_DEVTYP_DEVICEINTERFACE) |
| 115 static_cast<DWORD>(DBT_DEVTYP_DEVICEINTERFACE)); | 115 return TRUE; |
| 116 for (int i = 0; i < arraysize(kDeviceCategoryMap); ++i) { | 116 for (int i = 0; i < arraysize(kDeviceCategoryMap); ++i) { |
| 117 if (kDeviceCategoryMap[i].device_category == | 117 if (kDeviceCategoryMap[i].device_category == |
| 118 device_interface->dbcc_classguid) { | 118 device_interface->dbcc_classguid) { |
| 119 device_type = kDeviceCategoryMap[i].device_type; | 119 device_type = kDeviceCategoryMap[i].device_type; |
| 120 break; | 120 break; |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 // Devices that we do not have a DEVTYPE_ for, get detected via | 124 // Devices that we do not have a DEVTYPE_ for, get detected via |
| 125 // DBT_DEVNODES_CHANGED, so we avoid sending additional notifications | 125 // DBT_DEVNODES_CHANGED, so we avoid sending additional notifications |
| (...skipping 16 matching lines...) Expand all Loading... |
| 142 WPARAM wparam, LPARAM lparam) { | 142 WPARAM wparam, LPARAM lparam) { |
| 143 switch (message) { | 143 switch (message) { |
| 144 case WM_DEVICECHANGE: | 144 case WM_DEVICECHANGE: |
| 145 return OnDeviceChange(static_cast<UINT>(wparam), lparam); | 145 return OnDeviceChange(static_cast<UINT>(wparam), lparam); |
| 146 default: | 146 default: |
| 147 break; | 147 break; |
| 148 } | 148 } |
| 149 | 149 |
| 150 return ::DefWindowProc(hwnd, message, wparam, lparam); | 150 return ::DefWindowProc(hwnd, message, wparam, lparam); |
| 151 } | 151 } |
| OLD | NEW |