Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / storage_monitor / storage_monitor_win.h
blobd75b66227c6bd4c1bab34939f198d42d7ea0518c
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_
6 #define CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/storage_monitor/storage_monitor.h"
13 namespace base {
14 class FilePath;
17 class PortableDeviceWatcherWin;
18 class TestStorageMonitorWin;
19 class VolumeMountWatcherWin;
21 class StorageMonitorWin : public StorageMonitor {
22 public:
23 virtual ~StorageMonitorWin();
25 // Must be called after the file thread is created.
26 virtual void Init() OVERRIDE;
28 // StorageMonitor:
29 virtual bool GetStorageInfoForPath(const base::FilePath& path,
30 StorageInfo* device_info) const OVERRIDE;
31 virtual bool GetMTPStorageInfoFromDeviceId(
32 const std::string& storage_device_id,
33 base::string16* device_location,
34 base::string16* storage_object_id) const OVERRIDE;
36 virtual void EjectDevice(
37 const std::string& device_id,
38 base::Callback<void(EjectStatus)> callback) OVERRIDE;
40 private:
41 class PortableDeviceNotifications;
42 friend class TestStorageMonitorWin;
43 friend StorageMonitor* StorageMonitor::Create();
45 // To support unit tests, this constructor takes |volume_mount_watcher| and
46 // |portable_device_watcher| objects. These params are either constructed in
47 // unit tests or in StorageMonitorWin Create() function.
48 StorageMonitorWin(VolumeMountWatcherWin* volume_mount_watcher,
49 PortableDeviceWatcherWin* portable_device_watcher);
51 // Gets the removable storage information given a |device_path|. On success,
52 // returns true and fills in |info|.
53 bool GetDeviceInfo(const base::FilePath& device_path,
54 StorageInfo* info) const;
56 static LRESULT CALLBACK WndProcThunk(HWND hwnd, UINT message, WPARAM wparam,
57 LPARAM lparam);
59 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam,
60 LPARAM lparam);
62 void OnDeviceChange(UINT event_type, LPARAM data);
64 // The window class of |window_|.
65 ATOM window_class_;
67 // The handle of the module that contains the window procedure of |window_|.
68 HMODULE instance_;
69 HWND window_;
71 // The volume mount point watcher, used to manage the mounted devices.
72 scoped_ptr<VolumeMountWatcherWin> volume_mount_watcher_;
74 // The portable device watcher, used to manage media transfer protocol
75 // devices.
76 scoped_ptr<PortableDeviceWatcherWin> portable_device_watcher_;
78 DISALLOW_COPY_AND_ASSIGN(StorageMonitorWin);
81 #endif // CHROME_BROWSER_STORAGE_MONITOR_STORAGE_MONITOR_WIN_H_