1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Copyright (c) 2013 Intel Corporation. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
6 #ifndef XWALK_TIZEN_RENDERER_RENDERER_MEDIAPLAYER_MANAGER_H_
7 #define XWALK_TIZEN_RENDERER_RENDERER_MEDIAPLAYER_MANAGER_H_
11 #include "base/basictypes.h"
12 #include "content/public/renderer/render_view_observer.h"
16 class MediaPlayerImpl;
18 typedef int MediaPlayerID;
20 // Class for managing all the MediaPlayerImpl objects in the same
22 class RendererMediaPlayerManager : public content::RenderViewObserver {
24 // Constructs a RendererMediaPlayerManager object for the |render_view|.
25 explicit RendererMediaPlayerManager(content::RenderView* render_view);
26 virtual ~RendererMediaPlayerManager();
28 // RenderViewObserver overrides.
29 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
31 // Initializes a BrowserMediaPlayerManager object in browser process.
32 void Initialize(MediaPlayerID player_id,
37 void Start(MediaPlayerID player_id);
39 // Pausees the player.
40 void Pause(MediaPlayerID player_id);
42 // Destroy the player in the browser process
43 void DestroyPlayer(MediaPlayerID player_id);
45 // Register a MediaPlayerImpl object and return the ID of the player.
46 MediaPlayerID RegisterMediaPlayer(MediaPlayerImpl* player);
48 // Unregister a MediaPlayerImpl object of given |player_id|.
49 void UnregisterMediaPlayer(MediaPlayerID player_id);
52 // Get the pointer to MediaPlayerImpl of given |player_id|.
53 MediaPlayerImpl* GetMediaPlayer(MediaPlayerID player_id);
56 void OnPlayerPlay(MediaPlayerID player_id);
57 void OnPlayerPause(MediaPlayerID player_id);
59 // Info for all available MediaPlayerImpl on a page; kept so that
60 // we can enumerate them to send updates.
61 std::map<MediaPlayerID, MediaPlayerImpl*> media_players_;
63 MediaPlayerID next_media_player_id_;
65 DISALLOW_COPY_AND_ASSIGN(RendererMediaPlayerManager);
70 #endif // XWALK_TIZEN_RENDERER_RENDERER_MEDIAPLAYER_MANAGER_H_