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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 base::FilePath manifest_path = path.AppendASCII("manifest.json"); | 100 base::FilePath manifest_path = path.AppendASCII("manifest.json"); |
101 std::unique_ptr<Entry> entry = | 101 std::unique_ptr<Entry> entry = |
102 CreateEntryForManifestAt(manifest_path, package_dir); | 102 CreateEntryForManifestAt(manifest_path, package_dir); |
103 if (!entry) | 103 if (!entry) |
104 continue; | 104 continue; |
105 | 105 |
106 // Skip over subdirs that contain only manifests, they're artifacts of the | 106 // Skip over subdirs that contain only manifests, they're artifacts of the |
107 // build (e.g. for applications that are packaged into others) and are not | 107 // build (e.g. for applications that are packaged into others) and are not |
108 // valid standalone packages. | 108 // valid standalone packages. |
109 base::FilePath package_path = GetPackagePath(package_dir, entry->name()); | 109 base::FilePath package_path = GetPackagePath(package_dir, entry->name()); |
110 if (!base::PathExists(package_path)) | 110 if (entry->name() != "mojo:shell" && entry->name() != "mojo:catalog" && |
| 111 !base::PathExists(package_path)) { |
111 continue; | 112 continue; |
| 113 } |
112 | 114 |
113 original_thread_task_runner->PostTask( | 115 original_thread_task_runner->PostTask( |
114 FROM_HERE, | 116 FROM_HERE, |
115 base::Bind(read_manifest_callback, base::Passed(&entry))); | 117 base::Bind(read_manifest_callback, base::Passed(&entry))); |
116 } | 118 } |
117 | 119 |
118 original_thread_task_runner->PostTask(FROM_HERE, read_complete_closure); | 120 original_thread_task_runner->PostTask(FROM_HERE, read_complete_closure); |
119 } | 121 } |
120 | 122 |
121 std::unique_ptr<Entry> ReadManifest(const base::FilePath& package_dir, | 123 std::unique_ptr<Entry> ReadManifest(const base::FilePath& package_dir, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 EntryCache* cache, | 207 EntryCache* cache, |
206 const CreateEntryForNameCallback& entry_created_callback, | 208 const CreateEntryForNameCallback& entry_created_callback, |
207 std::unique_ptr<Entry> entry) { | 209 std::unique_ptr<Entry> entry) { |
208 shell::mojom::ResolveResultPtr result = | 210 shell::mojom::ResolveResultPtr result = |
209 shell::mojom::ResolveResult::From(*entry); | 211 shell::mojom::ResolveResult::From(*entry); |
210 AddEntryToCache(cache, std::move(entry)); | 212 AddEntryToCache(cache, std::move(entry)); |
211 entry_created_callback.Run(std::move(result)); | 213 entry_created_callback.Run(std::move(result)); |
212 } | 214 } |
213 | 215 |
214 } // namespace catalog | 216 } // namespace catalog |
OLD | NEW |