OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_WEB_CONTENTS_OBSERVER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_WEB_CONTENTS_OBSERVER_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "content/common/content_export.h" |
| 12 #include "content/public/browser/web_contents_observer.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 class BrowserMediaPlayerManager; |
| 17 class RenderViewHost; |
| 18 |
| 19 // This class manages all RenderFrame based media related managers at the |
| 20 // browser side. It receives IPC messages from media RenderFrameObservers and |
| 21 // forwards them to the corresponding managers. The managers are responsible |
| 22 // for sending IPCs back to the RenderFrameObservers at the render side. |
| 23 class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver { |
| 24 public: |
| 25 explicit MediaWebContentsObserver(RenderViewHost* render_view_host); |
| 26 virtual ~MediaWebContentsObserver(); |
| 27 |
| 28 // WebContentsObserver implementations. |
| 29 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE; |
| 30 virtual bool OnMessageReceived(const IPC::Message& message, |
| 31 RenderFrameHost* render_frame_host) OVERRIDE; |
| 32 |
| 33 // Gets the media player manager associated with |render_frame_host|. Creates |
| 34 // a new one if it doesn't exist. |
| 35 BrowserMediaPlayerManager* GetMediaPlayerManager( |
| 36 RenderFrameHost* render_frame_host); |
| 37 |
| 38 private: |
| 39 // Map from RenderFrameHost to BrowserMediaPlayerManager. |
| 40 std::map<RenderFrameHost*, BrowserMediaPlayerManager*> media_player_managers_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserver); |
| 43 }; |
| 44 |
| 45 } // namespace content |
| 46 |
| 47 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_WEB_CONTENTS_OBSERVER_H_ |
OLD | NEW |