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

Side by Side Diff: chrome/browser/system_monitor/removable_device_notifications_window_win.h

Issue 10917166: Extend the capability of SystemMonitor to support watching storage free space change (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update and add unit test Created 8 years, 3 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 unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_ H_ 5 #ifndef CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_ H_
6 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_ H_ 6 #define CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_WIN_ H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 15
16 typedef LRESULT (*VolumeNameFunc)(LPCWSTR drive, 16 typedef LRESULT (*VolumeNameFunc)(LPCWSTR drive,
17 LPWSTR volume_name, 17 LPWSTR volume_name,
18 unsigned int volume_name_len); 18 unsigned int volume_name_len);
19 namespace chrome { 19 namespace chrome {
20 20
21 class RemovableDeviceNotificationsWindowWin 21 class RemovableDeviceNotificationsWindowWin
22 : public base::RefCountedThreadSafe<RemovableDeviceNotificationsWindowWin> { 22 : public base::RefCountedThreadSafe<RemovableDeviceNotificationsWindowWin>,
23 public base::SystemMonitor::StorageFreeSpaceDelegate {
23 public: 24 public:
24 RemovableDeviceNotificationsWindowWin(); 25 RemovableDeviceNotificationsWindowWin();
25 // Only for use in unit tests. 26 // Only for use in unit tests.
26 explicit RemovableDeviceNotificationsWindowWin(VolumeNameFunc volumeNameFunc); 27 explicit RemovableDeviceNotificationsWindowWin(VolumeNameFunc volumeNameFunc);
27 28
28 LRESULT OnDeviceChange(UINT event_type, DWORD data); 29 LRESULT OnDeviceChange(UINT event_type, DWORD data);
29 30
30 private: 31 private:
31 friend class 32 friend class
32 base::RefCountedThreadSafe<RemovableDeviceNotificationsWindowWin>; 33 base::RefCountedThreadSafe<RemovableDeviceNotificationsWindowWin>;
(...skipping 14 matching lines...) Expand all
47 48
48 void CheckDeviceTypeOnFileThread(const std::string& id, 49 void CheckDeviceTypeOnFileThread(const std::string& id,
49 const FilePath::StringType& device_name, 50 const FilePath::StringType& device_name,
50 const FilePath& path); 51 const FilePath& path);
51 52
52 void ProcessRemovableDeviceAttachedOnUIThread( 53 void ProcessRemovableDeviceAttachedOnUIThread(
53 const std::string& id, 54 const std::string& id,
54 const FilePath::StringType& device_name, 55 const FilePath::StringType& device_name,
55 const FilePath& path); 56 const FilePath& path);
56 57
58 // Overriden from SystemMonitor::StorageFreeSpaceDelegate.
59 virtual void StartWatchingStorage(const FilePath& path) OVERRIDE;
60 virtual void StopWatchingStorage(const FilePath& path) OVERRIDE;
61
57 // The window class of |window_|. 62 // The window class of |window_|.
58 ATOM atom_; 63 ATOM atom_;
59 64
60 // The handle of the module that contains the window procedure of |window_|. 65 // The handle of the module that contains the window procedure of |window_|.
61 HMODULE instance_; 66 HMODULE instance_;
62 67
63 HWND window_; 68 HWND window_;
64 VolumeNameFunc volume_name_func_; 69 VolumeNameFunc volume_name_func_;
65 70
66 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsWindowWin); 71 DISALLOW_COPY_AND_ASSIGN(RemovableDeviceNotificationsWindowWin);
67 }; 72 };
68 73
69 } // namespace chrome 74 } // namespace chrome
70 75
71 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_W IN_H_ 76 #endif // CHROME_BROWSER_SYSTEM_MONITOR_REMOVABLE_DEVICE_NOTIFICATIONS_WINDOW_W IN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698