summaryrefslogtreecommitdiff
path: root/chromium/components/ntp_snippets/contextual/contextual_suggestions_reporter.cc
blob: ec68d6fe992bfdd9591f5d8838dd67b41654c521 (plain)
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
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/ntp_snippets/contextual/contextual_suggestions_reporter.h"

#include "base/debug/stack_trace.h"
#include "components/ntp_snippets/contextual/contextual_suggestions_composite_reporter.h"
#include "components/ntp_snippets/contextual/contextual_suggestions_debugging_reporter.h"
#include "components/ntp_snippets/contextual/contextual_suggestions_metrics_reporter.h"

namespace contextual_suggestions {

ContextualSuggestionsReporterProvider::ContextualSuggestionsReporterProvider(
    std::unique_ptr<ContextualSuggestionsDebuggingReporter> debugging_reporter)
    : debugging_reporter_(std::move(debugging_reporter)) {}

ContextualSuggestionsReporterProvider::
    ~ContextualSuggestionsReporterProvider() = default;

std::unique_ptr<ContextualSuggestionsReporter>
ContextualSuggestionsReporterProvider::CreateReporter() {
  std::unique_ptr<ContextualSuggestionsCompositeReporter> reporter =
      std::make_unique<ContextualSuggestionsCompositeReporter>();
  reporter->AddOwnedReporter(
      std::make_unique<ContextualSuggestionsMetricsReporter>());
  reporter->AddRawReporter(debugging_reporter_.get());
  return reporter;
}

ContextualSuggestionsDebuggingReporter*
ContextualSuggestionsReporterProvider::GetDebuggingReporter() {
  return debugging_reporter_.get();
}

ContextualSuggestionsReporter::ContextualSuggestionsReporter() = default;
ContextualSuggestionsReporter::~ContextualSuggestionsReporter() = default;

}  // namespace contextual_suggestions