Chromium Code Reviews| 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 // Pauses all media player. | |
| 39 void PauseVideo(); | |
| 40 | |
| 41 #if defined(VIDEO_HOLE) | |
| 42 void OnFrameInfoUpdated(); | |
| 43 #endif // defined(VIDEO_HOLE) | |
| 44 | |
| 45 private: | |
| 46 typedef std::map<RenderFrameHost*, BrowserMediaPlayerManager*> | |
|
qinmin
2014/05/23 01:40:23
nit: what about using ScopedPtrHashMap?
xhwang
2014/05/23 23:34:35
Done.
| |
| 47 MediaPlayerManagerMap; | |
| 48 MediaPlayerManagerMap media_player_managers_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserver); | |
| 51 }; | |
| 52 | |
| 53 } // namespace content | |
| 54 | |
| 55 #endif // CONTENT_BROWSER_MEDIA_ANDROID_MEDIA_WEB_CONTENTS_OBSERVER_H_ | |
| OLD | NEW |