| 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_STORAGE_INFO_PROVIDER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_STORAGE_INFO_PROVIDER_H_ |
| 6 #define EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_STORAGE_INFO_PROVIDER_H_ | 6 #define EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_STORAGE_INFO_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 namespace systeminfo { | 23 namespace systeminfo { |
| 24 | 24 |
| 25 // Build StorageUnitInfo struct from StorageInfo instance. The |unit| | 25 // Build StorageUnitInfo struct from StorageInfo instance. The |unit| |
| 26 // parameter is the output value. | 26 // parameter is the output value. |
| 27 void BuildStorageUnitInfo(const storage_monitor::StorageInfo& info, | 27 void BuildStorageUnitInfo(const storage_monitor::StorageInfo& info, |
| 28 api::system_storage::StorageUnitInfo* unit); | 28 api::system_storage::StorageUnitInfo* unit); |
| 29 | 29 |
| 30 } // namespace systeminfo | 30 } // namespace systeminfo |
| 31 | 31 |
| 32 typedef std::vector<linked_ptr<api::system_storage::StorageUnitInfo>> | 32 typedef std::vector<api::system_storage::StorageUnitInfo> StorageUnitInfoList; |
| 33 StorageUnitInfoList; | |
| 34 | 33 |
| 35 class StorageInfoProvider : public SystemInfoProvider { | 34 class StorageInfoProvider : public SystemInfoProvider { |
| 36 public: | 35 public: |
| 37 typedef base::Callback<void(const std::string&, double)> | 36 typedef base::Callback<void(const std::string&, double)> |
| 38 GetStorageFreeSpaceCallback; | 37 GetStorageFreeSpaceCallback; |
| 39 | 38 |
| 40 // Get the single shared instance of StorageInfoProvider. | 39 // Get the single shared instance of StorageInfoProvider. |
| 41 static StorageInfoProvider* Get(); | 40 static StorageInfoProvider* Get(); |
| 42 | 41 |
| 43 // SystemInfoProvider implementations | 42 // SystemInfoProvider implementations |
| 44 void PrepareQueryOnUIThread() override; | 43 void PrepareQueryOnUIThread() override; |
| 45 void InitializeProvider(const base::Closure& do_query_info_callback) override; | 44 void InitializeProvider(const base::Closure& do_query_info_callback) override; |
| 46 | 45 |
| 47 virtual double GetStorageFreeSpaceFromTransientIdOnFileThread( | 46 virtual double GetStorageFreeSpaceFromTransientIdOnFileThread( |
| 48 const std::string& transient_id); | 47 const std::string& transient_id); |
| 49 | 48 |
| 50 const StorageUnitInfoList& storage_unit_info_list() const; | 49 const StorageUnitInfoList& storage_unit_info_list() const { return info_; } |
| 51 | 50 |
| 52 static void InitializeForTesting(scoped_refptr<StorageInfoProvider> provider); | 51 static void InitializeForTesting(scoped_refptr<StorageInfoProvider> provider); |
| 53 | 52 |
| 54 protected: | 53 protected: |
| 55 StorageInfoProvider(); | 54 StorageInfoProvider(); |
| 56 | 55 |
| 57 ~StorageInfoProvider() override; | 56 ~StorageInfoProvider() override; |
| 58 | 57 |
| 59 // Put all available storages' information into |info_|. | 58 // Put all available storages' information into |info_|. |
| 60 void GetAllStoragesIntoInfoList(); | 59 void GetAllStoragesIntoInfoList(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 75 bool QueryInfo() override; | 74 bool QueryInfo() override; |
| 76 | 75 |
| 77 static base::LazyInstance<scoped_refptr<StorageInfoProvider> > provider_; | 76 static base::LazyInstance<scoped_refptr<StorageInfoProvider> > provider_; |
| 78 | 77 |
| 79 DISALLOW_COPY_AND_ASSIGN(StorageInfoProvider); | 78 DISALLOW_COPY_AND_ASSIGN(StorageInfoProvider); |
| 80 }; | 79 }; |
| 81 | 80 |
| 82 } // namespace extensions | 81 } // namespace extensions |
| 83 | 82 |
| 84 #endif // EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_STORAGE_INFO_PROVIDER_H_ | 83 #endif // EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_STORAGE_INFO_PROVIDER_H_ |
| OLD | NEW |