OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_SYSTEM_STORAGE_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_SYSTEM_STORAGE_API_H_ |
6 #define EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_SYSTEM_STORAGE_API_H_ | 6 #define EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_SYSTEM_STORAGE_API_H_ |
7 | 7 |
8 #include "components/storage_monitor/storage_monitor.h" | 8 #include "components/storage_monitor/storage_monitor.h" |
9 #include "extensions/browser/api/system_storage/storage_info_provider.h" | 9 #include "extensions/browser/api/system_storage/storage_info_provider.h" |
10 #include "extensions/browser/extension_function.h" | 10 #include "extensions/browser/extension_function.h" |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 | 13 |
14 // Implementation of the systeminfo.storage.get API. It is an asynchronous | 14 // Implementation of the systeminfo.storage.get API. It is an asynchronous |
15 // call relative to browser UI thread. | 15 // call relative to browser UI thread. |
16 class SystemStorageGetInfoFunction : public AsyncExtensionFunction { | 16 class SystemStorageGetInfoFunction : public AsyncExtensionFunction { |
17 public: | 17 public: |
18 DECLARE_EXTENSION_FUNCTION("system.storage.getInfo", SYSTEM_STORAGE_GETINFO); | 18 DECLARE_EXTENSION_FUNCTION("system.storage.getInfo", SYSTEM_STORAGE_GETINFO); |
19 SystemStorageGetInfoFunction(); | 19 SystemStorageGetInfoFunction(); |
20 | 20 |
21 private: | 21 private: |
22 virtual ~SystemStorageGetInfoFunction(); | 22 virtual ~SystemStorageGetInfoFunction(); |
23 virtual bool RunAsync() OVERRIDE; | 23 virtual bool RunAsync() override; |
24 | 24 |
25 void OnGetStorageInfoCompleted(bool success); | 25 void OnGetStorageInfoCompleted(bool success); |
26 }; | 26 }; |
27 | 27 |
28 class SystemStorageEjectDeviceFunction : public AsyncExtensionFunction { | 28 class SystemStorageEjectDeviceFunction : public AsyncExtensionFunction { |
29 public: | 29 public: |
30 DECLARE_EXTENSION_FUNCTION("system.storage.ejectDevice", | 30 DECLARE_EXTENSION_FUNCTION("system.storage.ejectDevice", |
31 SYSTEM_STORAGE_EJECTDEVICE); | 31 SYSTEM_STORAGE_EJECTDEVICE); |
32 | 32 |
33 protected: | 33 protected: |
34 virtual ~SystemStorageEjectDeviceFunction(); | 34 virtual ~SystemStorageEjectDeviceFunction(); |
35 | 35 |
36 // AsyncExtensionFunction overrides. | 36 // AsyncExtensionFunction overrides. |
37 virtual bool RunAsync() OVERRIDE; | 37 virtual bool RunAsync() override; |
38 | 38 |
39 private: | 39 private: |
40 void OnStorageMonitorInit(const std::string& transient_device_id); | 40 void OnStorageMonitorInit(const std::string& transient_device_id); |
41 | 41 |
42 // Eject device request handler. | 42 // Eject device request handler. |
43 void HandleResponse(storage_monitor::StorageMonitor::EjectStatus status); | 43 void HandleResponse(storage_monitor::StorageMonitor::EjectStatus status); |
44 }; | 44 }; |
45 | 45 |
46 class SystemStorageGetAvailableCapacityFunction | 46 class SystemStorageGetAvailableCapacityFunction |
47 : public AsyncExtensionFunction { | 47 : public AsyncExtensionFunction { |
48 public: | 48 public: |
49 DECLARE_EXTENSION_FUNCTION("system.storage.getAvailableCapacity", | 49 DECLARE_EXTENSION_FUNCTION("system.storage.getAvailableCapacity", |
50 SYSTEM_STORAGE_GETAVAILABLECAPACITY); | 50 SYSTEM_STORAGE_GETAVAILABLECAPACITY); |
51 SystemStorageGetAvailableCapacityFunction(); | 51 SystemStorageGetAvailableCapacityFunction(); |
52 | 52 |
53 private: | 53 private: |
54 void OnStorageMonitorInit(const std::string& transient_id); | 54 void OnStorageMonitorInit(const std::string& transient_id); |
55 void OnQueryCompleted(const std::string& transient_id, | 55 void OnQueryCompleted(const std::string& transient_id, |
56 double available_capacity); | 56 double available_capacity); |
57 virtual ~SystemStorageGetAvailableCapacityFunction(); | 57 virtual ~SystemStorageGetAvailableCapacityFunction(); |
58 virtual bool RunAsync() OVERRIDE; | 58 virtual bool RunAsync() override; |
59 }; | 59 }; |
60 | 60 |
61 } // namespace extensions | 61 } // namespace extensions |
62 | 62 |
63 #endif // EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_SYSTEM_STORAGE_API_H_ | 63 #endif // EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_SYSTEM_STORAGE_API_H_ |
OLD | NEW |