diff options
author | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-02 23:13:40 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-02 23:13:40 +0000 |
commit | df6c4198e717be00adaeadd89293ef20bc551ebc (patch) | |
tree | 4c03a73da2c74168a55da21e0f324fa422f312ad /base/system_monitor/system_monitor.h | |
parent | 7e2c66d4bc593360a26cb95d551f34ab8138fd0d (diff) | |
download | chromium_src-df6c4198e717be00adaeadd89293ef20bc551ebc.zip chromium_src-df6c4198e717be00adaeadd89293ef20bc551ebc.tar.gz chromium_src-df6c4198e717be00adaeadd89293ef20bc551ebc.tar.bz2 |
Add media device attach notification mechanism.
Split out from https://chromiumcodereview.appspot.com/9363008/
BUG=110400
TEST=NONE
Review URL: http://codereview.chromium.org/9580018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124763 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/system_monitor/system_monitor.h')
-rw-r--r-- | base/system_monitor/system_monitor.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/base/system_monitor/system_monitor.h b/base/system_monitor/system_monitor.h index 7684523..3f73b15 100644 --- a/base/system_monitor/system_monitor.h +++ b/base/system_monitor/system_monitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -6,6 +6,8 @@ #define BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ #pragma once +#include <string> + #include "base/base_export.h" #include "base/basictypes.h" #include "build/build_config.h" @@ -28,6 +30,8 @@ #include <IOKit/IOMessage.h> #endif // OS_MACOSX +class FilePath; + namespace base { // Class for monitoring various system-related subsystems @@ -42,6 +46,8 @@ class BASE_EXPORT SystemMonitor { RESUME_EVENT // The system is being resumed. }; + typedef unsigned int DeviceIdType; + // Create SystemMonitor. Only one SystemMonitor instance per application // is allowed. SystemMonitor(); @@ -93,8 +99,19 @@ class BASE_EXPORT SystemMonitor { class BASE_EXPORT DevicesChangedObserver { public: // Notification that the devices connected to the system have changed. + // This is only implemented on Windows currently. virtual void OnDevicesChanged() {} + // When a media device is attached or detached, one of these two events + // is triggered. + // TODO(vandebo) Pass an appropriate device identifier or way to interact + // with the devices instead of FilePath. + virtual void OnMediaDeviceAttached(const DeviceIdType& id, + const std::string& name, + const FilePath& path) {} + + virtual void OnMediaDeviceDetached(const DeviceIdType& id) {} + protected: virtual ~DevicesChangedObserver() {} }; @@ -123,6 +140,10 @@ class BASE_EXPORT SystemMonitor { // Cross-platform handling of a device change event. void ProcessDevicesChanged(); + void ProcessMediaDeviceAttached(const DeviceIdType& id, + const std::string& name, + const FilePath& path); + void ProcessMediaDeviceDetached(const DeviceIdType& id); private: #if defined(OS_MACOSX) @@ -141,6 +162,10 @@ class BASE_EXPORT SystemMonitor { // Functions to trigger notifications. void NotifyDevicesChanged(); + void NotifyMediaDeviceAttached(const DeviceIdType& id, + const std::string& name, + const FilePath& path); + void NotifyMediaDeviceDetached(const DeviceIdType& id); void NotifyPowerStateChange(); void NotifySuspend(); void NotifyResume(); |