Chromium Code Reviews| 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 != |
| 115 static_cast<DWORD>(DBT_DEVTYP_DEVICEINTERFACE)); | 115 static_cast<DWORD>(DBT_DEVTYP_DEVICEINTERFACE)) { |
|
piman
2012/09/14 00:37:44
nit: Is the static_cast needed anymore? If not, pl
vandebo (ex-Chrome)
2012/09/14 00:43:05
Done.
| |
| 116 return TRUE; | |
| 117 } | |
| 116 for (int i = 0; i < arraysize(kDeviceCategoryMap); ++i) { | 118 for (int i = 0; i < arraysize(kDeviceCategoryMap); ++i) { |
| 117 if (kDeviceCategoryMap[i].device_category == | 119 if (kDeviceCategoryMap[i].device_category == |
| 118 device_interface->dbcc_classguid) { | 120 device_interface->dbcc_classguid) { |
| 119 device_type = kDeviceCategoryMap[i].device_type; | 121 device_type = kDeviceCategoryMap[i].device_type; |
| 120 break; | 122 break; |
| 121 } | 123 } |
| 122 } | 124 } |
| 123 | 125 |
| 124 // Devices that we do not have a DEVTYPE_ for, get detected via | 126 // Devices that we do not have a DEVTYPE_ for, get detected via |
| 125 // DBT_DEVNODES_CHANGED, so we avoid sending additional notifications | 127 // DBT_DEVNODES_CHANGED, so we avoid sending additional notifications |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 142 WPARAM wparam, LPARAM lparam) { | 144 WPARAM wparam, LPARAM lparam) { |
| 143 switch (message) { | 145 switch (message) { |
| 144 case WM_DEVICECHANGE: | 146 case WM_DEVICECHANGE: |
| 145 return OnDeviceChange(static_cast<UINT>(wparam), lparam); | 147 return OnDeviceChange(static_cast<UINT>(wparam), lparam); |
| 146 default: | 148 default: |
| 147 break; | 149 break; |
| 148 } | 150 } |
| 149 | 151 |
| 150 return ::DefWindowProc(hwnd, message, wparam, lparam); | 152 return ::DefWindowProc(hwnd, message, wparam, lparam); |
| 151 } | 153 } |
| OLD | NEW |