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

ash / ambient / ambient_view_delegate_impl.cc [blame]

// Copyright 2020 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/ambient/ambient_view_delegate_impl.h"

#include "ash/ambient/ambient_controller.h"
#include "ash/ambient/model/ambient_backend_model.h"
#include "base/check.h"
#include "base/functional/bind.h"

namespace ash {

AmbientViewDelegateImpl::AmbientViewDelegateImpl(
    AmbientController* ambient_controller)
    : ambient_controller_(ambient_controller) {}

AmbientViewDelegateImpl::~AmbientViewDelegateImpl() = default;

void AmbientViewDelegateImpl::AddObserver(
    AmbientViewDelegateObserver* observer) {
  view_delegate_observers_.AddObserver(observer);
}

void AmbientViewDelegateImpl::RemoveObserver(
    AmbientViewDelegateObserver* observer) {
  view_delegate_observers_.RemoveObserver(observer);
}

AmbientBackendModel* AmbientViewDelegateImpl::GetAmbientBackendModel() {
  return ambient_controller_->GetAmbientBackendModel();
}

AmbientWeatherModel* AmbientViewDelegateImpl::GetAmbientWeatherModel() {
  return ambient_controller_->GetAmbientWeatherModel();
}

void AmbientViewDelegateImpl::NotifyObserversMarkerHit(
    AmbientPhotoConfig::Marker marker) {
  for (AmbientViewDelegateObserver& observer : view_delegate_observers_) {
    observer.OnMarkerHit(marker);
  }
}

}  // namespace ash