OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "extensions/common/consumer.h" |
| 6 |
| 7 const int ConsumerID::kDefaultInstanceID = 0; |
| 8 |
| 9 ConsumerID::ConsumerID() |
| 10 : host_type_(ConsumerID::EXTENSIONS), |
| 11 host_id_(std::string()), |
| 12 instance_type_(ConsumerID::TAB), |
| 13 instance_id_(ConsumerID::kDefaultInstanceID) { |
| 14 } |
| 15 |
| 16 ConsumerID::ConsumerID(const ConsumerID& other) |
| 17 : host_type_(other.host_type()), |
| 18 host_id_(other.host_id()), |
| 19 instance_type_(other.instance_type()), |
| 20 instance_id_(other.instance_id()) { |
| 21 } |
| 22 |
| 23 ConsumerID::ConsumerID(HostType host_type, |
| 24 const std::string& host_id, |
| 25 InstanceType instance_type, |
| 26 int instance_id) |
| 27 : host_type_(host_type), |
| 28 host_id_(host_id), |
| 29 instance_type_(instance_type), |
| 30 instance_id_(instance_id) { |
| 31 } |
| 32 |
| 33 bool ConsumerID::operator<(const ConsumerID& id) const { |
| 34 return host_type_ < id.host_type() || |
| 35 (host_type_ == id.host_type() && host_id_.compare(id.host_id()) < 0) || |
| 36 (host_type_ == id.host_type() && host_id_.compare(id.host_id()) == 0 && |
| 37 instance_type_ < id.instance_type()) || |
| 38 (host_type_ == id.host_type() && host_id_.compare(id.host_id()) == 0 && |
| 39 instance_type_ == id.instance_type() && |
| 40 instance_id_ < id.instance_id()); |
| 41 } |
| 42 |
| 43 ConsumerID::~ConsumerID() { |
| 44 } |
| 45 |
| 46 Consumer::Consumer() { |
| 47 } |
| 48 |
| 49 Consumer::~Consumer() { |
| 50 } |
OLD | NEW |