Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Unified Diff: content/browser/system_message_window_win.cc

Issue 10211008: Moves media device notification code to chrome/browser (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed indentation Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/system_message_window_win.h ('k') | content/browser/system_message_window_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/system_message_window_win.cc
diff --git a/content/browser/system_message_window_win.cc b/content/browser/system_message_window_win.cc
index 1aca1c1c184d960a3822aecac657442c5364f9ff..347e717d27f5e84e408ef977f8ecec6adaa2c1ac 100644
--- a/content/browser/system_message_window_win.cc
+++ b/content/browser/system_message_window_win.cc
@@ -6,50 +6,15 @@
#include <windows.h>
#include <dbt.h>
-#include <string>
-#include "base/file_path.h"
-#include "base/sys_string_conversions.h"
+#include "base/logging.h"
#include "base/system_monitor/system_monitor.h"
#include "base/win/wrapped_window_proc.h"
static const wchar_t* const WindowClassName = L"Chrome_SystemMessageWindow";
-namespace {
-LRESULT GetVolumeName(LPCWSTR drive,
- LPWSTR volume_name,
- unsigned int volume_name_len) {
- return GetVolumeInformation(drive, volume_name, volume_name_len, NULL, NULL,
- NULL, NULL, 0);
-}
-
-// Returns 0 if the devicetype is not volume.
-DWORD GetVolumeBitMaskFromBroadcastHeader(DWORD data) {
- PDEV_BROADCAST_HDR dev_broadcast_hdr =
- reinterpret_cast<PDEV_BROADCAST_HDR>(data);
- if (dev_broadcast_hdr->dbch_devicetype == DBT_DEVTYP_VOLUME) {
- PDEV_BROADCAST_VOLUME dev_broadcast_volume =
- reinterpret_cast<PDEV_BROADCAST_VOLUME>(dev_broadcast_hdr);
- return dev_broadcast_volume->dbcv_unitmask;
- }
- return 0;
-}
-
-} // namespace
-
-
-SystemMessageWindowWin::SystemMessageWindowWin()
- : volume_name_func_(&GetVolumeName) {
- Init();
-}
-
-SystemMessageWindowWin::SystemMessageWindowWin(VolumeNameFunc volume_name_func)
- : volume_name_func_(volume_name_func) {
- Init();
-}
-
-void SystemMessageWindowWin::Init() {
+SystemMessageWindowWin::SystemMessageWindowWin() {
HINSTANCE hinst = GetModuleHandle(NULL);
WNDCLASSEX wc = {0};
@@ -79,30 +44,6 @@ LRESULT SystemMessageWindowWin::OnDeviceChange(UINT event_type, DWORD data) {
case DBT_DEVNODES_CHANGED:
monitor->ProcessDevicesChanged();
break;
- case DBT_DEVICEARRIVAL: {
- DWORD unitmask = GetVolumeBitMaskFromBroadcastHeader(data);
- for (int i = 0; unitmask; ++i, unitmask >>= 1) {
- if (unitmask & 0x01) {
- FilePath::StringType drive(L"_:\\");
- drive[0] = L'A' + i;
- WCHAR volume_name[MAX_PATH + 1];
- if ((*volume_name_func_)(drive.c_str(), volume_name, MAX_PATH + 1)) {
- monitor->ProcessMediaDeviceAttached(
- i, base::SysWideToUTF8(volume_name), FilePath(drive));
- }
- }
- }
- break;
- }
- case DBT_DEVICEREMOVECOMPLETE: {
- DWORD unitmask = GetVolumeBitMaskFromBroadcastHeader(data);
- for (int i = 0; unitmask; ++i, unitmask >>= 1) {
- if (unitmask & 0x01) {
- monitor->ProcessMediaDeviceDetached(i);
- }
- }
- break;
- }
}
return TRUE;
}
« no previous file with comments | « content/browser/system_message_window_win.h ('k') | content/browser/system_message_window_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698