summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/api/display_source/display_source_session.cc
blob: df830079b057bd9ff6509d101e3cdfc5dfe33bf6 (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
40
41
42
43
44
45
46
// Copyright 2015 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 "extensions/renderer/api/display_source/display_source_session.h"

#if defined(ENABLE_WIFI_DISPLAY)
#include "extensions/renderer/api/display_source/wifi_display/wifi_display_session.h"
#endif

namespace extensions {

DisplaySourceSessionParams::DisplaySourceSessionParams()
    : auth_method(api::display_source::AUTHENTICATION_METHOD_NONE) {
}

DisplaySourceSessionParams::~DisplaySourceSessionParams() = default;

DisplaySourceSession::DisplaySourceSession()
    : state_(Idle) {
}

DisplaySourceSession::~DisplaySourceSession() = default;

void DisplaySourceSession::SetCallbacks(
    const SinkIdCallback& started_callback,
    const SinkIdCallback& terminated_callback,
    const ErrorCallback& error_callback) {
  DCHECK(started_callback_.is_null());
  DCHECK(terminated_callback_.is_null());
  DCHECK(error_callback_.is_null());

  started_callback_ = started_callback;
  terminated_callback_ = terminated_callback;
  error_callback_ = error_callback;
}

scoped_ptr<DisplaySourceSession> DisplaySourceSessionFactory::CreateSession(
    const DisplaySourceSessionParams& params) {
#if defined(ENABLE_WIFI_DISPLAY)
  return scoped_ptr<DisplaySourceSession>(new WiFiDisplaySession(params));
#endif
  return nullptr;
}

}  // namespace extensions