Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ | |
| 6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <list> | |
| 10 #include <string> | |
| 11 | |
| 12 #include "content/public/common/media_stream_request.h" | |
| 13 #include "third_party/skia/include/core/SkBitmap.h" | |
| 14 #include "ui/base/models/simple_menu_model.h" | |
| 15 | |
| 16 class StatusIcon; | |
| 17 class StatusTray; | |
| 18 | |
|
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.
| |
| 19 class MediaStreamCaptureIndicator : public ui::SimpleMenuModel::Delegate { | |
| 20 public: | |
| 21 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.
| |
| 22 virtual ~MediaStreamCaptureIndicator(); | |
| 23 | |
| 24 // Overrides from SimpleMenuModel::Delegate implementation. | |
| 25 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | |
| 26 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | |
| 27 virtual bool GetAcceleratorForCommandId(int command_id, | |
| 28 ui::Accelerator* accelerator) | |
| 29 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.
| |
| 30 virtual void ExecuteCommand(int command_id) OVERRIDE; | |
| 31 | |
| 32 // Called every time MediaStream opens the capture devices. | |
| 33 void OnCaptureDevicesOpened(const std::string& url, | |
| 34 const content::MediaStreamDevices& devices); | |
| 35 | |
| 36 // Called every time the MediaStream closes the opened devices. | |
| 37 void OnCaptureDevicesClosed(const std::string& url, | |
| 38 const content::MediaStreamDevices& devices); | |
| 39 | |
| 40 private: | |
| 41 // Struct to store the usage information of the capture devices. | |
| 42 struct CaptureDeviceUser { | |
| 43 CaptureDeviceUser(const std::string& url, | |
| 44 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.
| |
| 45 content::MediaStreamDeviceType type) | |
| 46 : host(url), | |
| 47 device(device), | |
| 48 type(type) {} | |
| 49 | |
| 50 std::string host; | |
| 51 std::string device; | |
| 52 content::MediaStreamDeviceType type; | |
| 53 }; | |
| 54 | |
| 55 // Creates the status tray if it has not been created. | |
| 56 void CreateStatusTray(); | |
| 57 | |
| 58 // Makes sure we have done one-time initialization of the |icon_image_|. | |
| 59 void EnsureStatusTrayIcon(); | |
| 60 | |
| 61 // Triggers a balloon in the corner telling users devices are being used. | |
| 62 void ShowBalloon(const std::string& url, | |
| 63 const content::MediaStreamDevices& devices); | |
| 64 | |
| 65 // Hides the status tray from the desktop. | |
| 66 void Hide(); | |
| 67 | |
| 68 // Adds the new user to the device usage list. | |
| 69 void AddCaptureDeviceUser(const std::string& url, | |
| 70 const content::MediaStreamDevices& devices); | |
| 71 | |
| 72 // Removes the user from the device usage list. | |
| 73 void RemoveCaptureDeviceUser(const std::string& url, | |
| 74 const content::MediaStreamDevices& devices); | |
| 75 | |
| 76 // Updates the status tray menu with the new device list. This call will be | |
| 77 // triggered by both |AddCaptureDeviceUser| and |RemoveCaptureDeviceUser|. | |
| 78 void UpdateStatusTrayIconContextMenu(); | |
| 79 | |
| 80 // Reference to our status icon - owned by the StatusTray. If null, | |
| 81 // the platform doesn't support status icons. | |
| 82 StatusIcon* status_icon_; | |
| 83 | |
| 84 // Icon to be displayed on the status tray. | |
| 85 SkBitmap icon_image_; | |
| 86 | |
| 87 typedef std::list<CaptureDeviceUser> CaptureDeviceUserList; | |
| 88 CaptureDeviceUserList users_; | |
| 89 }; | |
| 90 | |
| 91 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ | |
| OLD | NEW |