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

Side by Side Diff: mojo/shell/public/cpp/lib/names.cc

Issue 1828803002: Simplify resolve. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@61catalog
Patch Set: . Created 4 years, 9 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
« no previous file with comments | « mojo/services/catalog/reader.cc ('k') | mojo/shell/public/cpp/names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "mojo/shell/public/cpp/names.h" 5 #include "mojo/shell/public/cpp/names.h"
6 6
7 #include "base/strings/string_split.h" 7 #include "base/strings/string_split.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 9
10 namespace mojo { 10 namespace mojo {
11 11
12 const char kNameType_Mojo[] = "mojo";
13 const char kNameType_Exe[] = "exe";
14
12 bool IsValidName(const std::string& name) { 15 bool IsValidName(const std::string& name) {
13 std::vector<std::string> parts = 16 std::vector<std::string> parts =
14 base::SplitString(name, ":", base::KEEP_WHITESPACE, 17 base::SplitString(name, ":", base::KEEP_WHITESPACE,
15 base::SPLIT_WANT_ALL); 18 base::SPLIT_WANT_ALL);
16 if (parts.size() != 2) 19 if (parts.size() != 2)
17 return false; 20 return false;
18 21
19 if (parts.front().empty()) 22 if (parts.front().empty())
20 return false; 23 return false;
21 24
(...skipping 12 matching lines...) Expand all
34 37
35 std::string GetNamePath(const std::string& name) { 38 std::string GetNamePath(const std::string& name) {
36 std::vector<std::string> parts = 39 std::vector<std::string> parts =
37 base::SplitString(name, ":", base::KEEP_WHITESPACE, 40 base::SplitString(name, ":", base::KEEP_WHITESPACE,
38 base::SPLIT_WANT_ALL); 41 base::SPLIT_WANT_ALL);
39 DCHECK(2 == parts.size()); 42 DCHECK(2 == parts.size());
40 return parts.back(); 43 return parts.back();
41 } 44 }
42 45
43 } // namespace mojo 46 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/catalog/reader.cc ('k') | mojo/shell/public/cpp/names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698