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

Unified Diff: chrome/browser/extensions/api/system_info_storage/storage_info_provider_win.h

Issue 10836341: Add the basic code skeleton for system info event router (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Refine the implementations for storage event. Created 8 years, 4 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/api/system_info_storage/storage_info_provider_win.h
diff --git a/chrome/browser/extensions/api/system_info_storage/storage_info_provider_win.h b/chrome/browser/extensions/api/system_info_storage/storage_info_provider_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..8db8ee856b6755a8b88fb3fa835e26f1742c0d5b
--- /dev/null
+++ b/chrome/browser/extensions/api/system_info_storage/storage_info_provider_win.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+#ifndef CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_STORAGE_INFO_PROVIDER_WIN_H_
+#define CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_STORAGE_INFO_PROVIDER_WIN_H_
+
+#include "chrome/browser/extensions/api/system_info_storage/storage_info_provider.h"
+
+#include <map>
+#include <windows.h>
+
+#include "base/win/object_watcher.h"
+
+namespace extensions {
+
+// StorageInfoProvider implementation on Windows platform.
+class StorageInfoProviderWin
+ : public StorageInfoProvider,
+ public base::win::ObjectWatcher::Delegate {
+ public:
+ StorageInfoProviderWin();
+ virtual ~StorageInfoProviderWin();
+
+ // Overriden from StorageInfoProvider.
+ virtual bool QueryInfo(
+ api::experimental_system_info_storage::StorageInfo* info) OVERRIDE;
+ virtual bool QueryUnitInfo(const FilePath::StringType& path,
+ api::experimental_system_info_storage::StorageUnitInfo* info) OVERRIDE;
+
+ private:
+ struct StorageWatcherEntry {
+ string16 path;
+ base::win::ObjectWatcher watcher;
+ };
+ typedef std::map<HANDLE, linked_ptr<StorageWatcherEntry> > StorageWatcherMap;
+
+ // Overriden from StorageInfoProvider.
+ virtual bool PlatformStartWatching(
+ StorageInfoProvider::Delegate* delegate) OVERRIDE;
+ virtual bool PlatformStopWatching() OVERRIDE;
+
+ // Overriden from base::win::ObjectWatcher::Delegate
+ virtual void OnObjectSignaled(HANDLE handle) OVERRIDE;
+
+ // Map the HANDLE object that is used to find the change notification and
+ // its watcher entry. Once the HANDLE object gets signaled, we can know
+ // quickly the changes happened on which storage device.
+ StorageWatcherMap storage_watchers_;
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_SYSTEM_INFO_STORAGE_STORAGE_INFO_PROVIDER_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698