OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/service_manager/public/cpp/identity.h" | 5 #include "services/service_manager/public/cpp/identity.h" |
6 | 6 |
7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "services/service_manager/public/interfaces/connector.mojom.h" |
8 | 9 |
9 namespace service_manager { | 10 namespace service_manager { |
10 | 11 |
11 Identity::Identity() {} | 12 Identity::Identity() : Identity("", mojom::kInheritUserID, "") {} |
12 | 13 |
13 Identity::Identity(const std::string& name, const std::string& user_id) | 14 Identity::Identity(const std::string& name, const std::string& user_id) |
14 : Identity(name, user_id, "") {} | 15 : Identity(name, user_id, "") {} |
15 | 16 |
16 Identity::Identity(const std::string& name, const std::string& user_id, | 17 Identity::Identity(const std::string& name, const std::string& user_id, |
17 const std::string& instance) | 18 const std::string& instance) |
18 : name_(name), | 19 : name_(name), |
19 user_id_(user_id), | 20 user_id_(user_id), |
20 instance_(instance) { | 21 instance_(instance) { |
21 CHECK(!user_id.empty()); | 22 CHECK(!user_id.empty()); |
(...skipping 15 matching lines...) Expand all Loading... |
37 bool Identity::operator==(const Identity& other) const { | 38 bool Identity::operator==(const Identity& other) const { |
38 return other.name_ == name_ && other.instance_ == instance_ && | 39 return other.name_ == name_ && other.instance_ == instance_ && |
39 other.user_id_ == user_id_; | 40 other.user_id_ == user_id_; |
40 } | 41 } |
41 | 42 |
42 bool Identity::IsValid() const { | 43 bool Identity::IsValid() const { |
43 return !name_.empty() && base::IsValidGUID(user_id_); | 44 return !name_.empty() && base::IsValidGUID(user_id_); |
44 } | 45 } |
45 | 46 |
46 } // namespace service_manager | 47 } // namespace service_manager |
OLD | NEW |