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

Unified Diff: chrome/browser/extensions/system_info_event_router.h

Issue 12084017: [SystemInfo API] Implement systemInfo.storage.onAvailableCapacityChanged event (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add a stub file to pass building on Android Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/system_info_event_router.h
diff --git a/chrome/browser/extensions/system_info_event_router.h b/chrome/browser/extensions/system_info_event_router.h
index 3b5bf6005ca7e480254b5d489f2beac94dcfe25f..2492d929fd3cdb60b4f4f95a529092cfb433a512 100644
--- a/chrome/browser/extensions/system_info_event_router.h
+++ b/chrome/browser/extensions/system_info_event_router.h
@@ -10,6 +10,7 @@
#include "base/file_path.h"
#include "base/memory/singleton.h"
#include "base/values.h"
+#include "chrome/browser/extensions/api/system_info_storage/storage_info_provider.h"
#include "ui/gfx/display_observer.h"
namespace extensions {
@@ -30,7 +31,9 @@ struct CpuUpdateInfo;
// Since the system_monitor will be refactored along with media_gallery, once
// http://crbug.com/145400 is fixed, we need to update SystemInfoEventRouter
// accordingly.
-class SystemInfoEventRouter: public gfx::DisplayObserver {
+class SystemInfoEventRouter
+ : public gfx::DisplayObserver,
+ public StorageInfoObserver {
public:
static SystemInfoEventRouter* GetInstance();
@@ -41,11 +44,14 @@ class SystemInfoEventRouter: public gfx::DisplayObserver {
// Return true if the |event_name| is an event from systemInfo namespace.
static bool IsSystemInfoEvent(const std::string& event_name);
+ // StorageInfoObserver implementation:
+ virtual void OnStorageFreeSpaceChanged(const std::string& id,
+ double new_value,
+ double old_value) OVERRIDE;
+
// TODO(hongbo): The following methods should be likely overriden from
// SystemMonitor::DevicesChangedObserver once the http://crbug.com/145400
// is fixed.
- void OnStorageAvailableCapacityChanged(const std::string& id,
- int64 available_capacity);
void OnRemovableStorageAttached(const std::string& id,
const string16& name,
const FilePath::StringType& location);
@@ -67,6 +73,11 @@ class SystemInfoEventRouter: public gfx::DisplayObserver {
void DispatchEvent(const std::string& event_name,
scoped_ptr<base::ListValue> args);
+ // The callbacks of querying storage info to start and stop watching the
+ // storages. Called from UI thread.
+ void StartWatchingStorages(const StorageInfo& info, bool success);
+ void StopWatchingStorages(const StorageInfo& info, bool success);
+
// The callback for CPU sampling cycle. Called from FILE thread.
void OnNextCpuSampling(
scoped_ptr<api::experimental_system_info_cpu::CpuUpdateInfo> info);

Powered by Google App Engine
This is Rietveld 408576698