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 "base/compiler_specific.h" |
| 9 #include "base/containers/scoped_ptr_hash_map.h" |
| 10 #include "content/common/content_export.h" |
| 11 #include "content/public/browser/web_contents_observer.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 class BrowserMediaPlayerManager; |
| 16 class RenderViewHost; |
| 17 |
| 18 // This class manages all RenderFrame based media related managers at the |
| 19 // browser side. It receives IPC messages from media RenderFrameObservers and |
| 20 // forwards them to the corresponding managers. The managers are responsible |
| 21 // for sending IPCs back to the RenderFrameObservers at the render side. |
| 22 class CONTENT_EXPORT MediaWebContentsObserver : public WebContentsObserver { |
| 23 public: |
| 24 explicit MediaWebContentsObserver(RenderViewHost* render_view_host); |
| 25 virtual ~MediaWebContentsObserver(); |
| 26 |
| 27 // WebContentsObserver implementations. |
| 28 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE; |
| 29 virtual bool OnMessageReceived(const IPC::Message& message, |
| 30 RenderFrameHost* render_frame_host) OVERRIDE; |
| 31 |
| 32 // Gets the media player manager associated with |render_frame_host|. Creates |
| 33 // a new one if it doesn't exist. The caller doesn't own the returned pointer. |
| 34 BrowserMediaPlayerManager* GetMediaPlayerManager( |
| 35 RenderFrameHost* render_frame_host); |
| 36 |
| 37 // Pauses all media player. |
| 38 void PauseVideo(); |
| 39 |
| 40 #if defined(VIDEO_HOLE) |
| 41 void OnFrameInfoUpdated(); |
| 42 #endif // defined(VIDEO_HOLE) |
| 43 |
| 44 private: |
| 45 // Map from RenderFrameHost* to BrowserMediaPlayerManager. |
| 46 typedef base::ScopedPtrHashMap<uintptr_t, BrowserMediaPlayerManager> |
| 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 |