コード例 #1
0
AudioChannelState
AudioChannelServiceChild::GetState(AudioChannelAgent* aAgent, bool aElementHidden)
{
  AudioChannelAgentData* data;
  if (!mAgents.Get(aAgent, &data)) {
    return AUDIO_CHANNEL_STATE_MUTED;
  }

  AudioChannelState state = AUDIO_CHANNEL_STATE_MUTED;
  bool oldElementHidden = data->mElementHidden;

  UpdateChannelType(data->mChannel, CONTENT_PROCESS_ID_MAIN, aElementHidden,
                    oldElementHidden);

  // Update visibility.
  data->mElementHidden = aElementHidden;

  ContentChild* cc = ContentChild::GetSingleton();
  cc->SendAudioChannelGetState(data->mChannel, aElementHidden, oldElementHidden,
                               &state);
  data->mState = state;
  cc->SendAudioChannelChangedNotification();

  return state;
}
コード例 #2
0
bool
AudioChannelServiceChild::GetMuted(AudioChannelAgent* aAgent, bool aElementHidden)
{
  AudioChannelAgentData data;
  if (!mAgents.Get(aAgent, &data)) {
    return true;
  }

  ContentChild *cc = ContentChild::GetSingleton();
  bool muted = true;

  if (cc) {
    cc->SendAudioChannelGetMuted(data.mType, aElementHidden, data.mElementHidden, &muted);
  }

  // Update visibility.
  if (data.mElementHidden != aElementHidden || data.mMuted != muted) {
    data.mElementHidden = aElementHidden;
    data.mMuted = muted;
    mAgents.Put(aAgent, data);
  }

  if (cc) {
    cc->SendAudioChannelChangedNotification();
  }

  return muted;
}