Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: services/shell/public/cpp/lib/identity.cc

Issue 1882423004: Move shell service to toplevel shell namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/shell/public/cpp/identity.h" 5 #include "services/shell/public/cpp/identity.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "services/shell/public/cpp/names.h" 8 #include "services/shell/public/cpp/names.h"
9 9
10 namespace mojo { 10 namespace shell {
11 11
12 Identity::Identity() {} 12 Identity::Identity() {}
13 13
14 Identity::Identity(const std::string& name, const std::string& user_id) 14 Identity::Identity(const std::string& name, const std::string& user_id)
15 : Identity(name, user_id, "") {} 15 : Identity(name, user_id, "") {}
16 16
17 Identity::Identity(const std::string& name, const std::string& user_id, 17 Identity::Identity(const std::string& name, const std::string& user_id,
18 const std::string& instance) 18 const std::string& instance)
19 : name_(name), 19 : name_(name),
20 user_id_(user_id), 20 user_id_(user_id),
(...skipping 12 matching lines...) Expand all
33 if (instance_ != other.instance_) 33 if (instance_ != other.instance_)
34 return instance_ < other.instance_; 34 return instance_ < other.instance_;
35 return user_id_ < other.user_id_; 35 return user_id_ < other.user_id_;
36 } 36 }
37 37
38 bool Identity::operator==(const Identity& other) const { 38 bool Identity::operator==(const Identity& other) const {
39 return other.name_ == name_ && other.instance_ == instance_ && 39 return other.name_ == name_ && other.instance_ == instance_ &&
40 other.user_id_ == user_id_; 40 other.user_id_ == user_id_;
41 } 41 }
42 42
43 } // namespace shell
44
45 namespace mojo {
46
43 // static 47 // static
44 shell::mojom::IdentityPtr 48 shell::mojom::IdentityPtr
45 TypeConverter<shell::mojom::IdentityPtr, Identity>::Convert( 49 TypeConverter<shell::mojom::IdentityPtr, shell::Identity>::Convert(
46 const Identity& input) { 50 const shell::Identity& input) {
47 shell::mojom::IdentityPtr identity(shell::mojom::Identity::New()); 51 shell::mojom::IdentityPtr identity(shell::mojom::Identity::New());
48 identity->name = input.name(); 52 identity->name = input.name();
49 identity->user_id = input.user_id(); 53 identity->user_id = input.user_id();
50 identity->instance = input.instance(); 54 identity->instance = input.instance();
51 return identity; 55 return identity;
52 } 56 }
53 57
54 // static 58 // static
55 Identity TypeConverter<Identity, shell::mojom::IdentityPtr>::Convert( 59 shell::Identity
60 TypeConverter<shell::Identity, shell::mojom::IdentityPtr>::Convert(
56 const shell::mojom::IdentityPtr& input) { 61 const shell::mojom::IdentityPtr& input) {
57 return Identity(input->name, input->user_id, input->instance); 62 return shell::Identity(input->name, input->user_id, input->instance);
58 } 63 }
59 64
60 } // namespace mojo 65 } // namespace mojo
OLDNEW
« no previous file with comments | « services/shell/public/cpp/lib/connector_impl.cc ('k') | services/shell/public/cpp/lib/init_commandline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698