Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ | 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "content/browser/media/session/media_session_player_observer.h" | 10 #include "content/browser/media/session/media_session_player_observer.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 | 44 |
| 45 // Must be called when a pause occurs on the renderer side media player; keeps | 45 // Must be called when a pause occurs on the renderer side media player; keeps |
| 46 // the MediaSession instance in sync with renderer side behavior. | 46 // the MediaSession instance in sync with renderer side behavior. |
| 47 void OnPlaybackPaused(); | 47 void OnPlaybackPaused(); |
| 48 | 48 |
| 49 // MediaSessionObserver implementation. | 49 // MediaSessionObserver implementation. |
| 50 void OnSuspend(int player_id) override; | 50 void OnSuspend(int player_id) override; |
| 51 void OnResume(int player_id) override; | 51 void OnResume(int player_id) override; |
| 52 void OnSetVolumeMultiplier(int player_id, double volume_multiplier) override; | 52 void OnSetVolumeMultiplier(int player_id, double volume_multiplier) override; |
| 53 | 53 |
| 54 // Returns the WebContents-oriented media player id (RenderFrameHost and the | |
| 55 // frame-wise id). | |
| 56 const WebContentsObserver::MediaPlayerId& id() { return id_; }; | |
|
whywhat
2016/11/28 19:59:14
nit: give it a more descriptive name, it's confusi
Zhiqiang Zhang (Slow)
2016/11/30 16:40:59
Done.
| |
| 57 | |
| 54 // Test helpers. | 58 // Test helpers. |
| 55 int get_player_id_for_testing() const { return player_id_; } | 59 int get_player_id_for_testing() const { return player_id_; } |
| 56 | 60 |
| 57 private: | 61 private: |
| 58 const WebContentsObserver::MediaPlayerId id_; | 62 const WebContentsObserver::MediaPlayerId id_; |
| 59 | 63 |
| 60 // Non-owned pointer; |media_web_contents_observer_| is the owner of |this|. | 64 // Non-owned pointer; |media_web_contents_observer_| is the owner of |this|. |
| 61 MediaWebContentsObserver* const media_web_contents_observer_; | 65 MediaWebContentsObserver* const media_web_contents_observer_; |
| 62 | 66 |
| 63 // Non-owned pointer; lifetime is the same as |media_web_contents_observer_|. | 67 // Non-owned pointer; lifetime is the same as |media_web_contents_observer_|. |
| 64 MediaSessionImpl* const media_session_; | 68 MediaSessionImpl* const media_session_; |
| 65 | 69 |
| 66 int player_id_ = 0; | 70 int player_id_ = 0; |
| 67 bool has_session_ = false; | 71 bool has_session_ = false; |
| 68 | 72 |
| 69 DISALLOW_COPY_AND_ASSIGN(MediaSessionController); | 73 DISALLOW_COPY_AND_ASSIGN(MediaSessionController); |
| 70 }; | 74 }; |
| 71 | 75 |
| 72 } // namespace content | 76 } // namespace content |
| 73 | 77 |
| 74 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ | 78 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_CONTROLLER_H_ |
| OLD | NEW |