Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(519)

Side by Side Diff: content/browser/media/session/pepper_player_delegate.cc

Issue 2060933002: Let Flash join and be controlled by media session (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pepper_to_contents
Patch Set: addressed dcheng and mlamouri's comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/media/session/pepper_player_delegate.h"
6
7 #include "content/browser/frame_host/render_frame_host_impl.h"
8 #include "content/browser/media/session/pepper_playback_observer.h"
9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/common/frame_messages.h"
11
12 namespace content {
13
14 namespace {
15 const double kDuckVolume = 0.2f;
16 const int kPlayerId = 0;
dcheng 2016/07/01 05:57:59 Note: this is fine, but my comment was directed mo
Zhiqiang Zhang (Slow) 2016/07/01 11:01:07 OK, now I moved all the Ids in one place (pepper_p
17 } // anonymous namespace
18
19 PepperPlayerDelegate::PepperPlayerDelegate(
20 WebContentsImpl* contents, int32_t pp_instance)
21 : contents_(contents),
22 pp_instance_(pp_instance) {}
23
24 PepperPlayerDelegate::~PepperPlayerDelegate() = default;
25
26 void PepperPlayerDelegate::OnSuspend(int player_id) {
27 // Pepper player cannot be really suspended. Duck the volume instead.
28 DCHECK_EQ(player_id, kPlayerId);
29 SetVolume(player_id, kDuckVolume);
30 }
31
32 void PepperPlayerDelegate::OnResume(int player_id) {
33 DCHECK_EQ(player_id, kPlayerId);
34 SetVolume(player_id, 1.0f);
35 }
36
37 void PepperPlayerDelegate::OnSetVolumeMultiplier(int player_id,
38 double volume_multiplier) {
39 DCHECK_EQ(player_id, kPlayerId);
40 SetVolume(player_id, volume_multiplier);
41 }
42
43 void PepperPlayerDelegate::SetVolume(int player_id, double volume) {
44 contents_->Send(new FrameMsg_SetPepperVolume(
45 contents_->GetMainFrame()->routing_id(), pp_instance_, volume));
46 }
47
48 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/session/pepper_player_delegate.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698