| OLD | NEW |
| (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 } // anonymous namespace |
| 17 |
| 18 PepperPlayerDelegate::PepperPlayerDelegate( |
| 19 WebContentsImpl* contents, int32_t pp_instance) |
| 20 : contents_(contents), |
| 21 pp_instance_(pp_instance) {} |
| 22 |
| 23 PepperPlayerDelegate::~PepperPlayerDelegate() = default; |
| 24 |
| 25 void PepperPlayerDelegate::OnSuspend(int player_id) { |
| 26 DCHECK_EQ(player_id, 0); |
| 27 SetVolume(player_id, kDuckVolume); |
| 28 } |
| 29 |
| 30 void PepperPlayerDelegate::OnResume(int player_id) { |
| 31 DCHECK_EQ(player_id, 0); |
| 32 SetVolume(player_id, 1.0f); |
| 33 } |
| 34 |
| 35 void PepperPlayerDelegate::OnSetVolumeMultiplier(int player_id, |
| 36 double volume_multiplier) { |
| 37 DCHECK_EQ(player_id, 0); |
| 38 SetVolume(player_id, volume_multiplier); |
| 39 } |
| 40 |
| 41 void PepperPlayerDelegate::SetVolume(int player_id, double volume) { |
| 42 contents_->Send(new FrameMsg_SetPepperVolume( |
| 43 contents_->GetMainFrame()->routing_id(), pp_instance_, volume)); |
| 44 } |
| 45 |
| 46 } // namespace content |
| OLD | NEW |