Commit ba218f9f authored by Hokein.Wu@gmail.com's avatar Hokein.Wu@gmail.com

[SystemInfo API] Add Storage Watch API Definition.

BUG=177605
TEST=compiled

Review URL: https://chromiumcodereview.appspot.com/15815002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204019 0039d316-1c4b-4281-b951-d872f2087c98
parent fe0e4c08
...@@ -33,4 +33,50 @@ void SystemInfoStorageGetFunction::OnGetStorageInfoCompleted( ...@@ -33,4 +33,50 @@ void SystemInfoStorageGetFunction::OnGetStorageInfoCompleted(
SendResponse(success); SendResponse(success);
} }
SystemInfoStorageAddWatchFunction::SystemInfoStorageAddWatchFunction() {
}
SystemInfoStorageAddWatchFunction::~SystemInfoStorageAddWatchFunction() {
}
bool SystemInfoStorageAddWatchFunction::RunImpl() {
// TODO(Haojian): Implement the addWatch api.
return false;
}
SystemInfoStorageRemoveWatchFunction::SystemInfoStorageRemoveWatchFunction() {
}
SystemInfoStorageRemoveWatchFunction::~SystemInfoStorageRemoveWatchFunction() {
}
bool SystemInfoStorageRemoveWatchFunction::RunImpl() {
// TODO(Haojian): Implement the removeWatch api.
return false;
}
SystemInfoStorageGetAllWatchFunction::SystemInfoStorageGetAllWatchFunction() {
}
SystemInfoStorageGetAllWatchFunction::~SystemInfoStorageGetAllWatchFunction() {
}
bool SystemInfoStorageGetAllWatchFunction::RunImpl() {
// TODO(Haojian): Implement the getAllWatch api.
return false;
}
SystemInfoStorageRemoveAllWatchFunction::
SystemInfoStorageRemoveAllWatchFunction() {
}
SystemInfoStorageRemoveAllWatchFunction::
~SystemInfoStorageRemoveAllWatchFunction() {
}
bool SystemInfoStorageRemoveAllWatchFunction::RunImpl() {
// TODO(Haojian): Implement the removeAllWatch api.
return false;
}
} // namespace extensions } // namespace extensions
...@@ -24,6 +24,50 @@ class SystemInfoStorageGetFunction : public AsyncExtensionFunction { ...@@ -24,6 +24,50 @@ class SystemInfoStorageGetFunction : public AsyncExtensionFunction {
void OnGetStorageInfoCompleted(const StorageInfo& info, bool success); void OnGetStorageInfoCompleted(const StorageInfo& info, bool success);
}; };
class SystemInfoStorageAddWatchFunction : public AsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("experimental.systemInfo.storage.addWatch",
EXPERIMENTAL_SYSTEMINFO_STORAGE_ADDWATCH);
SystemInfoStorageAddWatchFunction();
private:
virtual ~SystemInfoStorageAddWatchFunction();
virtual bool RunImpl() OVERRIDE;
};
class SystemInfoStorageRemoveWatchFunction : public SyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("experimental.systemInfo.storage.removeWatch",
EXPERIMENTAL_SYSTEMINFO_STORAGE_REMOVEWATCH);
SystemInfoStorageRemoveWatchFunction();
private:
virtual ~SystemInfoStorageRemoveWatchFunction();
virtual bool RunImpl() OVERRIDE;
};
class SystemInfoStorageGetAllWatchFunction : public SyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("experimental.systemInfo.storage.getAllWatch",
EXPERIMENTAL_SYSTEMINFO_STORAGE_GETALLWATCH);
SystemInfoStorageGetAllWatchFunction();
private:
virtual ~SystemInfoStorageGetAllWatchFunction();
virtual bool RunImpl() OVERRIDE;
};
class SystemInfoStorageRemoveAllWatchFunction : public SyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("experimental.systemInfo.storage.removeAllWatch",
EXPERIMENTAL_SYSTEMINFO_STORAGE_REMOVEALLWATCH);
SystemInfoStorageRemoveAllWatchFunction();
private:
virtual ~SystemInfoStorageRemoveAllWatchFunction();
virtual bool RunImpl() OVERRIDE;
};
} // namespace extensions } // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_SYSTEM_INFO_STORAGE_API_H_ #endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_SYSTEM_INFO_STORAGE_API_H_
...@@ -541,6 +541,10 @@ enum HistogramValue { ...@@ -541,6 +541,10 @@ enum HistogramValue {
TTS_PAUSE, TTS_PAUSE,
TTS_RESUME, TTS_RESUME,
SYSTEMINFO_CPU_GET, SYSTEMINFO_CPU_GET,
EXPERIMENTAL_SYSTEMINFO_STORAGE_ADDWATCH,
EXPERIMENTAL_SYSTEMINFO_STORAGE_REMOVEWATCH,
EXPERIMENTAL_SYSTEMINFO_STORAGE_GETALLWATCH,
EXPERIMENTAL_SYSTEMINFO_STORAGE_REMOVEALLWATCH,
ENUM_BOUNDARY // Last entry: Add new entries above. ENUM_BOUNDARY // Last entry: Add new entries above.
}; };
......
...@@ -31,12 +31,35 @@ namespace experimental.systemInfo.storage { ...@@ -31,12 +31,35 @@ namespace experimental.systemInfo.storage {
double availableCapacity; double availableCapacity;
}; };
// A dictionary that describes the add particular storage device watch
// request results.
dictionary AddWatchResult {
DOMString id;
boolean success;
};
callback StorageInfoCallback = void (StorageUnitInfo[] info); callback StorageInfoCallback = void (StorageUnitInfo[] info);
callback AddWatchCallback = void (AddWatchResult info);
callback GetAllWatchCallback = void (DOMString[] storageIds);
interface Functions { interface Functions {
// Get the storage information from the system. The argument passed to the // Get the storage information from the system. The argument passed to the
// callback is an array of StorageUnitInfo objects. // callback is an array of StorageUnitInfo objects.
static void get(StorageInfoCallback callback); static void get(StorageInfoCallback callback);
// Monitor a particular storage device available change capacity.
static void addWatch(DOMString id, AddWatchCallback callback);
// Remove the monitor of a particular device.
static void removeWatch(DOMString id);
// Get all the watched storage devices.
static void getAllWatch(GetAllWatchCallback callback);
// Remove all the storage devices monitors.
static void removeAllWatch();
}; };
interface Events { interface Events {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment