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

Side by Side Diff: extensions/browser/api/system_storage/storage_info_provider.h

Issue 389633002: Move system.* family of APIs to extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 6 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 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 CHROME_BROWSER_EXTENSIONS_API_SYSTEM_STORAGE_STORAGE_INFO_PROVIDER_H_ 5 #ifndef EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_STORAGE_INFO_PROVIDER_H_
6 #define CHROME_BROWSER_EXTENSIONS_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"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/observer_list_threadsafe.h" 12 #include "base/observer_list_threadsafe.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "chrome/browser/extensions/api/system_info/system_info_provider.h" 14 #include "extensions/browser/api/system_info/system_info_provider.h"
15 #include "chrome/common/extensions/api/system_storage.h" 15 #include "extensions/common/api/system_storage.h"
16 16
17 namespace storage_monitor { 17 namespace storage_monitor {
18 class StorageInfo; 18 class StorageInfo;
19 } 19 }
20 20
21 namespace extensions { 21 namespace extensions {
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 core_api::system_storage::StorageUnitInfo* unit);
29 29
30 } // namespace systeminfo 30 } // namespace systeminfo
31 31
32 typedef std::vector<linked_ptr< 32 typedef std::vector<linked_ptr<core_api::system_storage::StorageUnitInfo> >
33 api::system_storage::StorageUnitInfo> > 33 StorageUnitInfoList;
34 StorageUnitInfoList;
35 34
36 class StorageInfoProvider : public SystemInfoProvider { 35 class StorageInfoProvider : public SystemInfoProvider {
37 public: 36 public:
38 typedef base::Callback<void(const std::string&, double)> 37 typedef base::Callback<void(const std::string&, double)>
39 GetStorageFreeSpaceCallback; 38 GetStorageFreeSpaceCallback;
40 39
41 // Get the single shared instance of StorageInfoProvider. 40 // Get the single shared instance of StorageInfoProvider.
42 static StorageInfoProvider* Get(); 41 static StorageInfoProvider* Get();
43 42
44 // SystemInfoProvider implementations 43 // SystemInfoProvider implementations
45 virtual void PrepareQueryOnUIThread() OVERRIDE; 44 virtual void PrepareQueryOnUIThread() OVERRIDE;
46 virtual void InitializeProvider(const base::Closure& do_query_info_callback) 45 virtual void InitializeProvider(
47 OVERRIDE; 46 const base::Closure& do_query_info_callback) OVERRIDE;
48 47
49 virtual double GetStorageFreeSpaceFromTransientIdOnFileThread( 48 virtual double GetStorageFreeSpaceFromTransientIdOnFileThread(
50 const std::string& transient_id); 49 const std::string& transient_id);
51 50
52 const StorageUnitInfoList& storage_unit_info_list() const; 51 const StorageUnitInfoList& storage_unit_info_list() const;
53 52
54 static void InitializeForTesting(scoped_refptr<StorageInfoProvider> provider); 53 static void InitializeForTesting(scoped_refptr<StorageInfoProvider> provider);
55 54
56 protected: 55 protected:
57 StorageInfoProvider(); 56 StorageInfoProvider();
(...skipping 18 matching lines...) Expand all
76 // the blocking pool, including fixed and removable devices. 75 // the blocking pool, including fixed and removable devices.
77 virtual bool QueryInfo() OVERRIDE; 76 virtual bool QueryInfo() OVERRIDE;
78 77
79 static base::LazyInstance<scoped_refptr<StorageInfoProvider> > provider_; 78 static base::LazyInstance<scoped_refptr<StorageInfoProvider> > provider_;
80 79
81 DISALLOW_COPY_AND_ASSIGN(StorageInfoProvider); 80 DISALLOW_COPY_AND_ASSIGN(StorageInfoProvider);
82 }; 81 };
83 82
84 } // namespace extensions 83 } // namespace extensions
85 84
86 #endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_STORAGE_STORAGE_INFO_PROVIDER_H_ 85 #endif // EXTENSIONS_BROWSER_API_SYSTEM_STORAGE_STORAGE_INFO_PROVIDER_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/system_storage/OWNERS ('k') | extensions/browser/api/system_storage/storage_info_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698