summaryrefslogtreecommitdiffstats
path: root/extensions/common/host_id.cc
blob: e7d474fefc5024940fcaa17aeee0c64f955e39f3 (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
// 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/common/host_id.h"

HostID::HostID()
    : type_(HostType::EXTENSIONS) {
}

HostID::HostID(HostType type, const std::string& id)
    : type_(type), id_(id) {
}

HostID::HostID(const HostID& host_id)
    : type_(host_id.type()),
      id_(host_id.id()) {
}

HostID::~HostID() {
}

bool HostID::operator<(const HostID& host_id) const {
  if (type_ != host_id.type())
    return type_ < host_id.type();
  else if (id_ != host_id.id())
    return id_ < host_id.id();
  return false;
}

bool HostID::operator==(const HostID& host_id) const {
  return type_ == host_id.type() && id_ == host_id.id();
}