| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // JavaScript call to GetUserMedia. F.E a camera or microphone. | 53 // JavaScript call to GetUserMedia. F.E a camera or microphone. |
| 54 void SetDeviceInfo(const StreamDeviceInfo& device_info); | 54 void SetDeviceInfo(const StreamDeviceInfo& device_info); |
| 55 | 55 |
| 56 // Sets a callback that will be triggered when StopSource is called. | 56 // Sets a callback that will be triggered when StopSource is called. |
| 57 void SetStopCallback(const SourceStoppedCallback& stop_callback); | 57 void SetStopCallback(const SourceStoppedCallback& stop_callback); |
| 58 | 58 |
| 59 // Clears the previously-set SourceStoppedCallback so that it will not be run | 59 // Clears the previously-set SourceStoppedCallback so that it will not be run |
| 60 // in the future. | 60 // in the future. |
| 61 void ResetSourceStoppedCallback(); | 61 void ResetSourceStoppedCallback(); |
| 62 | 62 |
| 63 // Connects this source to the given |track|, creating the appropriate |
| 64 // implementation of the content::MediaStreamTrack interface, which |
| 65 // becomes associated with and owned by |track|. Returns true if the source |
| 66 // was successfully started. |
| 67 virtual bool ConnectToTrack(const blink::WebMediaStreamTrack& track) = 0; // {
return false; } |
| 68 |
| 63 protected: | 69 protected: |
| 64 // Called when StopSource is called. It allows derived classes to implement | 70 // Called when StopSource is called. It allows derived classes to implement |
| 65 // its own Stop method. | 71 // its own Stop method. |
| 66 virtual void DoStopSource() = 0; | 72 virtual void DoStopSource() = 0; |
| 67 | 73 |
| 68 private: | 74 private: |
| 69 StreamDeviceInfo device_info_; | 75 StreamDeviceInfo device_info_; |
| 70 SourceStoppedCallback stop_callback_; | 76 SourceStoppedCallback stop_callback_; |
| 71 | 77 |
| 72 // In debug builds, check that all methods are being called on the main | 78 // In debug builds, check that all methods are being called on the main |
| 73 // thread. | 79 // thread. |
| 74 base::ThreadChecker thread_checker_; | 80 base::ThreadChecker thread_checker_; |
| 75 | 81 |
| 76 DISALLOW_COPY_AND_ASSIGN(MediaStreamSource); | 82 DISALLOW_COPY_AND_ASSIGN(MediaStreamSource); |
| 77 }; | 83 }; |
| 78 | 84 |
| 79 } // namespace content | 85 } // namespace content |
| 80 | 86 |
| 81 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_ | 87 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_SOURCE_H_ |
| OLD | NEW |