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 #ifndef CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_STORAGE_INFO_PROVIDER_
H_ | 4 #ifndef CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_STORAGE_INFO_PROVIDER_
H_ |
5 #define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_STORAGE_INFO_PROVIDER_
H_ | 5 #define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_STORAGE_INFO_PROVIDER_
H_ |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/observer_list_threadsafe.h" | 10 #include "base/observer_list_threadsafe.h" |
11 #include "base/timer.h" | 11 #include "base/timer.h" |
12 #include "chrome/browser/extensions/api/system_info/system_info_provider.h" | 12 #include "chrome/browser/extensions/api/system_info/system_info_provider.h" |
13 #include "chrome/browser/extensions/api/system_info_storage/storage_info_observe
r.h" | 13 #include "chrome/browser/extensions/api/system_info_storage/storage_info_observe
r.h" |
14 #include "chrome/browser/storage_monitor/removable_storage_observer.h" | 14 #include "chrome/browser/storage_monitor/removable_storage_observer.h" |
15 #include "chrome/browser/storage_monitor/storage_info.h" | 15 #include "chrome/browser/storage_monitor/storage_info.h" |
16 #include "chrome/common/extensions/api/experimental_system_info_storage.h" | 16 #include "chrome/common/extensions/api/experimental_system_info_storage.h" |
17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
| 21 |
21 namespace systeminfo { | 22 namespace systeminfo { |
22 | 23 |
23 // TODO(hongbo): Here the storage type is declared as string type due to the | |
24 // IDL doesn't support enum type yet. Once http://crbug.com/141940 is fixed, | |
25 // we could reuse enum values generated by IDL compiler. | |
26 | |
27 // Unknown storage type. | |
28 extern const char kStorageTypeUnknown[]; | 24 extern const char kStorageTypeUnknown[]; |
29 // Hard disk. | 25 extern const char kStorageTypeFixed[]; |
30 extern const char kStorageTypeHardDisk[]; | |
31 // Removable storage, e.g. USB device, flash card reader. | |
32 extern const char kStorageTypeRemovable[]; | 26 extern const char kStorageTypeRemovable[]; |
33 | 27 |
34 } // namespace systeminfo | 28 } // namespace systeminfo |
35 | 29 |
36 typedef std::vector<linked_ptr< | 30 typedef std::vector<linked_ptr< |
37 api::experimental_system_info_storage::StorageUnitInfo> > StorageInfo; | 31 api::experimental_system_info_storage::StorageUnitInfo> > StorageInfo; |
38 | 32 |
39 class StorageInfoProvider | 33 class StorageInfoProvider |
40 : public SystemInfoProvider<StorageInfo>, | 34 : public SystemInfoProvider<StorageInfo>, |
41 public chrome::RemovableStorageObserver { | 35 public chrome::RemovableStorageObserver { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 scoped_refptr<ObserverListThreadSafe<StorageInfoObserver> > observers_; | 101 scoped_refptr<ObserverListThreadSafe<StorageInfoObserver> > observers_; |
108 | 102 |
109 // The time interval for watching the free space change, in milliseconds. | 103 // The time interval for watching the free space change, in milliseconds. |
110 // Only changed for testing purposes. | 104 // Only changed for testing purposes. |
111 size_t watching_interval_; | 105 size_t watching_interval_; |
112 }; | 106 }; |
113 | 107 |
114 } // namespace extensions | 108 } // namespace extensions |
115 | 109 |
116 #endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_STORAGE_INFO_PROVID
ER_H_ | 110 #endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_STORAGE_INFO_PROVID
ER_H_ |
OLD | NEW |