blob: b3b1e17aab07958153c9c4154840d0fb6d16f40f [file] [log] [blame]
Hidehiko Abeac2e5512017-11-21 09:54:461// Copyright 2017 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 "components/arc/connection_notifier.h"
6
7#include "components/arc/connection_observer.h"
8
9namespace arc {
10namespace internal {
11
12ConnectionNotifier::ConnectionNotifier() = default;
13
14ConnectionNotifier::~ConnectionNotifier() = default;
15
16void ConnectionNotifier::AddObserver(ConnectionObserverBase* observer) {
17 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
18 observer_list_.AddObserver(observer);
19}
20
21void ConnectionNotifier::RemoveObserver(ConnectionObserverBase* observer) {
22 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
23 observer_list_.RemoveObserver(observer);
24}
25
26void ConnectionNotifier::NotifyConnectionReady() {
27 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
28 for (auto& observer : observer_list_)
29 observer.OnConnectionReady();
30}
31
32void ConnectionNotifier::NotifyConnectionClosed() {
33 DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
34 for (auto& observer : observer_list_)
35 observer.OnConnectionClosed();
36}
37
38} // namespace internal
39} // namespace arc