| 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_
|
|
|