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

Side by Side Diff: mojo/services/catalog/entry.cc

Issue 1821383002: Moves manifest parsing to a new class, Reader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@60catref
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/entry.h ('k') | mojo/services/catalog/reader.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/services/catalog/entry.h" 5 #include "mojo/services/catalog/entry.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "mojo/services/catalog/store.h" 8 #include "mojo/services/catalog/store.h"
9 #include "mojo/shell/public/cpp/names.h" 9 #include "mojo/shell/public/cpp/names.h"
10 10
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 entry->set_display_name(display_name); 172 entry->set_display_name(display_name);
173 const base::DictionaryValue* capabilities = nullptr; 173 const base::DictionaryValue* capabilities = nullptr;
174 if (!value.GetDictionary(Store::kCapabilitiesKey, &capabilities)) { 174 if (!value.GetDictionary(Store::kCapabilitiesKey, &capabilities)) {
175 LOG(WARNING) << "Entry::Description: dictionary has no capabilities key"; 175 LOG(WARNING) << "Entry::Description: dictionary has no capabilities key";
176 return nullptr; 176 return nullptr;
177 } 177 }
178 if (manifest_version == 0) 178 if (manifest_version == 0)
179 entry->set_capabilities(BuildCapabilitiesV0(*capabilities)); 179 entry->set_capabilities(BuildCapabilitiesV0(*capabilities));
180 else 180 else
181 entry->set_capabilities(BuildCapabilitiesV1(*capabilities)); 181 entry->set_capabilities(BuildCapabilitiesV1(*capabilities));
182
183 if (value.HasKey(Store::kApplicationsKey)) {
184 const base::ListValue* applications = nullptr;
185 value.GetList(Store::kApplicationsKey, &applications);
186 for (size_t i = 0; i < applications->GetSize(); ++i) {
187 const base::DictionaryValue* application = nullptr;
188 applications->GetDictionary(i, &application);
189 scoped_ptr<Entry> child = Entry::Deserialize(*application);
190 if (child)
191 entry->applications_.insert(*child);
192 }
193 }
194
182 return entry; 195 return entry;
183 } 196 }
184 197
185 bool Entry::operator==(const Entry& other) const { 198 bool Entry::operator==(const Entry& other) const {
186 return other.name_ == name_ && other.qualifier_ == qualifier_ && 199 return other.name_ == name_ && other.qualifier_ == qualifier_ &&
187 other.display_name_ == display_name_ && 200 other.display_name_ == display_name_ &&
188 other.capabilities_ == capabilities_; 201 other.capabilities_ == capabilities_;
189 } 202 }
190 203
204 bool Entry::operator<(const Entry& other) const {
205 return std::tie(name_, qualifier_, display_name_, capabilities_) <
206 std::tie(other.name_, other.qualifier_, other.display_name_,
207 other.capabilities_);
208 }
209
191 } // catalog 210 } // catalog
OLDNEW
« no previous file with comments | « mojo/services/catalog/entry.h ('k') | mojo/services/catalog/reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698