| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ |
| 6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ | 6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 public: | 34 public: |
| 35 MediaStreamCaptureIndicator(); | 35 MediaStreamCaptureIndicator(); |
| 36 | 36 |
| 37 // Registers a new media stream for |web_contents| and returns UI object | 37 // Registers a new media stream for |web_contents| and returns UI object |
| 38 // that's used by the content layer to notify about state of the stream. | 38 // that's used by the content layer to notify about state of the stream. |
| 39 scoped_ptr<content::MediaStreamUI> RegisterMediaStream( | 39 scoped_ptr<content::MediaStreamUI> RegisterMediaStream( |
| 40 content::WebContents* web_contents, | 40 content::WebContents* web_contents, |
| 41 const content::MediaStreamDevices& devices); | 41 const content::MediaStreamDevices& devices); |
| 42 | 42 |
| 43 // Overrides from StatusIconMenuModel::Delegate implementation. | 43 // Overrides from StatusIconMenuModel::Delegate implementation. |
| 44 virtual void ExecuteCommand(int command_id, int event_flags) override; | 44 void ExecuteCommand(int command_id, int event_flags) override; |
| 45 | 45 |
| 46 // Returns true if the |web_contents| is capturing user media (e.g., webcam or | 46 // Returns true if the |web_contents| is capturing user media (e.g., webcam or |
| 47 // microphone input). | 47 // microphone input). |
| 48 bool IsCapturingUserMedia(content::WebContents* web_contents) const; | 48 bool IsCapturingUserMedia(content::WebContents* web_contents) const; |
| 49 | 49 |
| 50 // Returns true if the |web_contents| is capturing video (e.g., webcam). | 50 // Returns true if the |web_contents| is capturing video (e.g., webcam). |
| 51 bool IsCapturingVideo(content::WebContents* web_contents) const; | 51 bool IsCapturingVideo(content::WebContents* web_contents) const; |
| 52 | 52 |
| 53 // Returns true if the |web_contents| is capturing audio (e.g., microphone). | 53 // Returns true if the |web_contents| is capturing audio (e.g., microphone). |
| 54 bool IsCapturingAudio(content::WebContents* web_contents) const; | 54 bool IsCapturingAudio(content::WebContents* web_contents) const; |
| 55 | 55 |
| 56 // Returns true if the |web_contents| itself is being mirrored (e.g., a source | 56 // Returns true if the |web_contents| itself is being mirrored (e.g., a source |
| 57 // of media for remote broadcast). | 57 // of media for remote broadcast). |
| 58 bool IsBeingMirrored(content::WebContents* web_contents) const; | 58 bool IsBeingMirrored(content::WebContents* web_contents) const; |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 class UIDelegate; | 61 class UIDelegate; |
| 62 class WebContentsDeviceUsage; | 62 class WebContentsDeviceUsage; |
| 63 friend class WebContentsDeviceUsage; | 63 friend class WebContentsDeviceUsage; |
| 64 | 64 |
| 65 friend class base::RefCountedThreadSafe<MediaStreamCaptureIndicator>; | 65 friend class base::RefCountedThreadSafe<MediaStreamCaptureIndicator>; |
| 66 virtual ~MediaStreamCaptureIndicator(); | 66 ~MediaStreamCaptureIndicator() override; |
| 67 | 67 |
| 68 // Following functions/variables are executed/accessed only on UI thread. | 68 // Following functions/variables are executed/accessed only on UI thread. |
| 69 | 69 |
| 70 // Called by WebContentsDeviceUsage when it's about to destroy itself, i.e. | 70 // Called by WebContentsDeviceUsage when it's about to destroy itself, i.e. |
| 71 // when WebContents is being destroyed. | 71 // when WebContents is being destroyed. |
| 72 void UnregisterWebContents(content::WebContents* web_contents); | 72 void UnregisterWebContents(content::WebContents* web_contents); |
| 73 | 73 |
| 74 // Updates the status tray menu. Called by WebContentsDeviceUsage. | 74 // Updates the status tray menu. Called by WebContentsDeviceUsage. |
| 75 void UpdateNotificationUserInterface(); | 75 void UpdateNotificationUserInterface(); |
| 76 | 76 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 100 UsageMap usage_map_; | 100 UsageMap usage_map_; |
| 101 | 101 |
| 102 // A vector which maps command IDs to their associated WebContents | 102 // A vector which maps command IDs to their associated WebContents |
| 103 // instance. This is rebuilt each time the status tray icon context menu is | 103 // instance. This is rebuilt each time the status tray icon context menu is |
| 104 // updated. | 104 // updated. |
| 105 typedef std::vector<content::WebContents*> CommandTargets; | 105 typedef std::vector<content::WebContents*> CommandTargets; |
| 106 CommandTargets command_targets_; | 106 CommandTargets command_targets_; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ | 109 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ |
| OLD | NEW |