| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 base::FilePath manifest_path = path.AppendASCII("manifest.json"); | 106 base::FilePath manifest_path = path.AppendASCII("manifest.json"); |
| 107 std::unique_ptr<Entry> entry = | 107 std::unique_ptr<Entry> entry = |
| 108 CreateEntryForManifestAt(manifest_path, package_dir); | 108 CreateEntryForManifestAt(manifest_path, package_dir); |
| 109 if (!entry) | 109 if (!entry) |
| 110 continue; | 110 continue; |
| 111 | 111 |
| 112 // Skip over subdirs that contain only manifests, they're artifacts of the | 112 // Skip over subdirs that contain only manifests, they're artifacts of the |
| 113 // build (e.g. for applications that are packaged into others) and are not | 113 // build (e.g. for applications that are packaged into others) and are not |
| 114 // valid standalone packages. | 114 // valid standalone packages. |
| 115 base::FilePath package_path = GetExecutablePath(package_dir, entry->name()); | 115 base::FilePath package_path = GetExecutablePath(package_dir, entry->name()); |
| 116 if (entry->name() != "service:shell" && | 116 if (entry->name() != "service:service_manager" && |
| 117 entry->name() != "service:catalog" && | 117 entry->name() != "service:catalog" && !base::PathExists(package_path)) { |
| 118 !base::PathExists(package_path)) { | |
| 119 continue; | 118 continue; |
| 120 } | 119 } |
| 121 | 120 |
| 122 original_thread_task_runner->PostTask( | 121 original_thread_task_runner->PostTask( |
| 123 FROM_HERE, | 122 FROM_HERE, |
| 124 base::Bind(read_manifest_callback, base::Passed(&entry))); | 123 base::Bind(read_manifest_callback, base::Passed(&entry))); |
| 125 } | 124 } |
| 126 | 125 |
| 127 original_thread_task_runner->PostTask(FROM_HERE, read_complete_closure); | 126 original_thread_task_runner->PostTask(FROM_HERE, read_complete_closure); |
| 128 } | 127 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 std::unique_ptr<Entry> entry) { | 251 std::unique_ptr<Entry> entry) { |
| 253 if (!entry) | 252 if (!entry) |
| 254 return; | 253 return; |
| 255 service_manager::mojom::ResolveResultPtr result = | 254 service_manager::mojom::ResolveResultPtr result = |
| 256 service_manager::mojom::ResolveResult::From(*entry); | 255 service_manager::mojom::ResolveResult::From(*entry); |
| 257 AddEntryToCache(cache, std::move(entry)); | 256 AddEntryToCache(cache, std::move(entry)); |
| 258 entry_created_callback.Run(std::move(result)); | 257 entry_created_callback.Run(std::move(result)); |
| 259 } | 258 } |
| 260 | 259 |
| 261 } // namespace catalog | 260 } // namespace catalog |
| OLD | NEW |