Chromium Code Reviews| Index: chrome/browser/media/media_stream_capture_indicator.h |
| diff --git a/chrome/browser/media/media_stream_capture_indicator.h b/chrome/browser/media/media_stream_capture_indicator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d33b4196efaf659c0ec4ae3632bda5e5b89ed3b5 |
| --- /dev/null |
| +++ b/chrome/browser/media/media_stream_capture_indicator.h |
| @@ -0,0 +1,91 @@ |
| +// 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_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ |
| +#define CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ |
| +#pragma once |
| + |
| +#include <list> |
| +#include <string> |
| + |
| +#include "content/public/common/media_stream_request.h" |
| +#include "third_party/skia/include/core/SkBitmap.h" |
| +#include "ui/base/models/simple_menu_model.h" |
| + |
| +class StatusIcon; |
| +class StatusTray; |
| + |
|
Nico
2012/04/25 15:52:51
class comment that explains why this exists / what
no longer working on chromium
2012/04/30 09:59:38
Done.
|
| +class MediaStreamCaptureIndicator : public ui::SimpleMenuModel::Delegate { |
| + public: |
| + explicit MediaStreamCaptureIndicator(); |
|
MAD
2012/04/25 15:34:53
I think you only need explicit when there is a sin
no longer working on chromium
2012/04/30 09:59:38
Done.
|
| + virtual ~MediaStreamCaptureIndicator(); |
| + |
| + // Overrides from SimpleMenuModel::Delegate implementation. |
| + virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
| + virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
| + virtual bool GetAcceleratorForCommandId(int command_id, |
| + ui::Accelerator* accelerator) |
| + OVERRIDE; |
|
MAD
2012/04/25 15:34:53
OVERRIDE should be indented 4 columns... Or you co
no longer working on chromium
2012/04/30 09:59:38
hope this is fine.
|
| + virtual void ExecuteCommand(int command_id) OVERRIDE; |
| + |
| + // Called every time MediaStream opens the capture devices. |
| + void OnCaptureDevicesOpened(const std::string& url, |
| + const content::MediaStreamDevices& devices); |
| + |
| + // Called every time the MediaStream closes the opened devices. |
| + void OnCaptureDevicesClosed(const std::string& url, |
| + const content::MediaStreamDevices& devices); |
| + |
| + private: |
| + // Struct to store the usage information of the capture devices. |
| + struct CaptureDeviceUser { |
| + CaptureDeviceUser(const std::string& url, |
| + const std::string device, |
|
MAD
2012/04/25 15:34:53
Why not a & reference here?
no longer working on chromium
2012/04/30 09:59:38
a mistake, thanks.
|
| + content::MediaStreamDeviceType type) |
| + : host(url), |
| + device(device), |
| + type(type) {} |
| + |
| + std::string host; |
| + std::string device; |
| + content::MediaStreamDeviceType type; |
| + }; |
| + |
| + // Creates the status tray if it has not been created. |
| + void CreateStatusTray(); |
| + |
| + // Makes sure we have done one-time initialization of the |icon_image_|. |
| + void EnsureStatusTrayIcon(); |
| + |
| + // Triggers a balloon in the corner telling users devices are being used. |
| + void ShowBalloon(const std::string& url, |
| + const content::MediaStreamDevices& devices); |
| + |
| + // Hides the status tray from the desktop. |
| + void Hide(); |
| + |
| + // Adds the new user to the device usage list. |
| + void AddCaptureDeviceUser(const std::string& url, |
| + const content::MediaStreamDevices& devices); |
| + |
| + // Removes the user from the device usage list. |
| + void RemoveCaptureDeviceUser(const std::string& url, |
| + const content::MediaStreamDevices& devices); |
| + |
| + // Updates the status tray menu with the new device list. This call will be |
| + // triggered by both |AddCaptureDeviceUser| and |RemoveCaptureDeviceUser|. |
| + void UpdateStatusTrayIconContextMenu(); |
| + |
| + // Reference to our status icon - owned by the StatusTray. If null, |
| + // the platform doesn't support status icons. |
| + StatusIcon* status_icon_; |
| + |
| + // Icon to be displayed on the status tray. |
| + SkBitmap icon_image_; |
| + |
| + typedef std::list<CaptureDeviceUser> CaptureDeviceUserList; |
| + CaptureDeviceUserList users_; |
| +}; |
| + |
| +#endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ |