1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_WINDOW_WIN_H_
#define CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_WINDOW_WIN_H_
#pragma once
#include <windows.h>
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/memory/ref_counted.h"
typedef LRESULT (*VolumeNameFunc)(LPCWSTR drive,
LPWSTR volume_name,
unsigned int volume_name_len);
namespace chrome {
class MediaDeviceNotificationsWindowWin
: public base::RefCountedThreadSafe<MediaDeviceNotificationsWindowWin> {
public:
MediaDeviceNotificationsWindowWin();
// Only for use in unit tests.
explicit MediaDeviceNotificationsWindowWin(VolumeNameFunc volumeNameFunc);
LRESULT OnDeviceChange(UINT event_type, DWORD data);
private:
friend class base::RefCountedThreadSafe<MediaDeviceNotificationsWindowWin>;
virtual ~MediaDeviceNotificationsWindowWin();
void Init();
LRESULT CALLBACK WndProc(HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam);
static LRESULT CALLBACK WndProcThunk(HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam);
void CheckDeviceTypeOnFileThread(unsigned int id,
const FilePath::StringType& device_name,
const FilePath& path);
void ProcessMediaDeviceAttachedOnUIThread(
unsigned int id,
const FilePath::StringType& device_name,
const FilePath& path);
// The window class of |window_|.
ATOM atom_;
// The handle of the module that contains the window procedure of |window_|.
HMODULE instance_;
HWND window_;
VolumeNameFunc volume_name_func_;
DISALLOW_COPY_AND_ASSIGN(MediaDeviceNotificationsWindowWin);
};
} // namespace chrome
#endif // CHROME_BROWSER_MEDIA_GALLERY_MEDIA_DEVICE_NOTIFICATIONS_WINDOW_WIN_H_
|