1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54

ash / multi_capture / multi_capture_service_client.cc [blame]

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/multi_capture/multi_capture_service_client.h"

#include "base/logging.h"

namespace ash {

MultiCaptureServiceClient::MultiCaptureServiceClient(
    mojo::PendingRemote<video_capture::mojom::MultiCaptureService>
        multi_capture_service)
    : multi_capture_service_(std::move(multi_capture_service)) {
  multi_capture_service_->AddObserver(
      multi_capture_service_observer_receiver_.BindNewPipeAndPassRemote());
}

MultiCaptureServiceClient::~MultiCaptureServiceClient() {
  for (Observer& observer : observers_)
    observer.MultiCaptureServiceClientDestroyed();
}

void MultiCaptureServiceClient::AddObserver(Observer* observer) {
  observers_.AddObserver(observer);
}

void MultiCaptureServiceClient::RemoveObserver(Observer* observer) {
  observers_.RemoveObserver(observer);
}

void MultiCaptureServiceClient::MultiCaptureStarted(const std::string& label,
                                                    const url::Origin& origin) {
  for (Observer& observer : observers_) {
    observer.MultiCaptureStarted(label, origin);
  }
}

void MultiCaptureServiceClient::MultiCaptureStartedFromApp(
    const std::string& label,
    const std::string& app_id,
    const std::string& app_short_name) {
  for (Observer& observer : observers_) {
    observer.MultiCaptureStartedFromApp(label, app_id, app_short_name);
  }
}

void MultiCaptureServiceClient::MultiCaptureStopped(const std::string& label) {
  for (Observer& observer : observers_) {
    observer.MultiCaptureStopped(label);
  }
}

}  // namespace ash