| 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/catalog/reader.h" | 5 #include "services/catalog/reader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 174 } |
| 175 | 175 |
| 176 void Reader::CreateEntryForName( | 176 void Reader::CreateEntryForName( |
| 177 const std::string& mojo_name, | 177 const std::string& mojo_name, |
| 178 EntryCache* cache, | 178 EntryCache* cache, |
| 179 const CreateEntryForNameCallback& entry_created_callback) { | 179 const CreateEntryForNameCallback& entry_created_callback) { |
| 180 std::string manifest_contents; | 180 std::string manifest_contents; |
| 181 if (manifest_provider_ && | 181 if (manifest_provider_ && |
| 182 manifest_provider_->GetApplicationManifest(mojo_name, | 182 manifest_provider_->GetApplicationManifest(mojo_name, |
| 183 &manifest_contents)) { | 183 &manifest_contents)) { |
| 184 if (manifest_contents.empty()) |
| 185 return; |
| 184 std::unique_ptr<base::Value> manifest_root = | 186 std::unique_ptr<base::Value> manifest_root = |
| 185 base::JSONReader::Read(manifest_contents); | 187 base::JSONReader::Read(manifest_contents); |
| 186 base::PostTaskAndReplyWithResult( | 188 base::PostTaskAndReplyWithResult( |
| 187 file_task_runner_.get(), FROM_HERE, | 189 file_task_runner_.get(), FROM_HERE, |
| 188 base::Bind(&ProcessManifest, base::Passed(&manifest_root), | 190 base::Bind(&ProcessManifest, base::Passed(&manifest_root), |
| 189 system_package_dir_), | 191 system_package_dir_), |
| 190 base::Bind(&Reader::OnReadManifest, weak_factory_.GetWeakPtr(), cache, | 192 base::Bind(&Reader::OnReadManifest, weak_factory_.GetWeakPtr(), cache, |
| 191 entry_created_callback)); | 193 entry_created_callback)); |
| 192 } else { | 194 } else { |
| 193 base::PostTaskAndReplyWithResult( | 195 base::PostTaskAndReplyWithResult( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 207 EntryCache* cache, | 209 EntryCache* cache, |
| 208 const CreateEntryForNameCallback& entry_created_callback, | 210 const CreateEntryForNameCallback& entry_created_callback, |
| 209 std::unique_ptr<Entry> entry) { | 211 std::unique_ptr<Entry> entry) { |
| 210 shell::mojom::ResolveResultPtr result = | 212 shell::mojom::ResolveResultPtr result = |
| 211 shell::mojom::ResolveResult::From(*entry); | 213 shell::mojom::ResolveResult::From(*entry); |
| 212 AddEntryToCache(cache, std::move(entry)); | 214 AddEntryToCache(cache, std::move(entry)); |
| 213 entry_created_callback.Run(std::move(result)); | 215 entry_created_callback.Run(std::move(result)); |
| 214 } | 216 } |
| 215 | 217 |
| 216 } // namespace catalog | 218 } // namespace catalog |
| OLD | NEW |