summaryrefslogtreecommitdiff
path: root/chromium/content/browser/presentation/presentation_type_converters.cc
blob: cd649976d5f1b56486c7b71a01c247a8d46e831a (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
// 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 "content/browser/presentation/presentation_type_converters.h"

#include "base/logging.h"

namespace content {

presentation::PresentationErrorType PresentationErrorTypeToMojo(
    content::PresentationErrorType input) {
  switch (input) {
    case content::PRESENTATION_ERROR_NO_AVAILABLE_SCREENS:
      return presentation::PRESENTATION_ERROR_TYPE_NO_AVAILABLE_SCREENS;
    case content::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED:
      return presentation::PRESENTATION_ERROR_TYPE_SESSION_REQUEST_CANCELLED;
    case content::PRESENTATION_ERROR_NO_PRESENTATION_FOUND:
      return presentation::PRESENTATION_ERROR_TYPE_NO_PRESENTATION_FOUND;
    case content::PRESENTATION_ERROR_UNKNOWN:
      return presentation::PRESENTATION_ERROR_TYPE_UNKNOWN;
  }
  NOTREACHED();
  return presentation::PRESENTATION_ERROR_TYPE_UNKNOWN;
}

presentation::PresentationConnectionState PresentationConnectionStateToMojo(
    content::PresentationConnectionState state) {
  switch (state) {
    case content::PRESENTATION_CONNECTION_STATE_CONNECTING:
      return presentation::PRESENTATION_CONNECTION_STATE_CONNECTING;
    case content::PRESENTATION_CONNECTION_STATE_CONNECTED:
      return presentation::PRESENTATION_CONNECTION_STATE_CONNECTED;
    case content::PRESENTATION_CONNECTION_STATE_CLOSED:
      return presentation::PRESENTATION_CONNECTION_STATE_CLOSED;
    case content::PRESENTATION_CONNECTION_STATE_TERMINATED:
      return presentation::PRESENTATION_CONNECTION_STATE_TERMINATED;
  }
  NOTREACHED();
  return presentation::PRESENTATION_CONNECTION_STATE_TERMINATED;
}

}  // namespace content