| 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 "mojo/services/catalog/catalog.h" | 5 #include "mojo/services/catalog/catalog.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Catalog, public: | 74 // Catalog, public: |
| 75 | 75 |
| 76 Catalog::Catalog(scoped_ptr<Store> store, | 76 Catalog::Catalog(scoped_ptr<Store> store, |
| 77 base::TaskRunner* file_task_runner, | 77 base::TaskRunner* file_task_runner, |
| 78 EntryCache* system_catalog) | 78 EntryCache* system_catalog) |
| 79 : store_(std::move(store)), | 79 : store_(std::move(store)), |
| 80 file_task_runner_(file_task_runner), | 80 file_task_runner_(file_task_runner), |
| 81 system_catalog_(system_catalog), | 81 system_catalog_(system_catalog), |
| 82 weak_factory_(this) { | 82 weak_factory_(this) { |
| 83 PathService::Get(base::DIR_MODULE, &system_package_dir_); | 83 PathService::Get(base::DIR_MODULE, &system_package_dir_); |
| 84 system_package_dir_ = |
| 85 system_package_dir_.Append(FILE_PATH_LITERAL("Mojo Applications")); |
| 84 DeserializeCatalog(); | 86 DeserializeCatalog(); |
| 85 } | 87 } |
| 86 | 88 |
| 87 Catalog::~Catalog() {} | 89 Catalog::~Catalog() {} |
| 88 | 90 |
| 89 void Catalog::BindResolver(mojom::ResolverRequest request) { | 91 void Catalog::BindResolver(mojom::ResolverRequest request) { |
| 90 resolver_bindings_.AddBinding(this, std::move(request)); | 92 resolver_bindings_.AddBinding(this, std::move(request)); |
| 91 } | 93 } |
| 92 | 94 |
| 93 void Catalog::BindShellResolver( | 95 void Catalog::BindShellResolver( |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 EntryCache* catalog = is_system_catalog ? system_catalog_ : &user_catalog_; | 233 EntryCache* catalog = is_system_catalog ? system_catalog_ : &user_catalog_; |
| 232 if (catalog->end() != catalog->find(entry->name())) | 234 if (catalog->end() != catalog->find(entry->name())) |
| 233 return; | 235 return; |
| 234 for (auto child : entry->applications()) | 236 for (auto child : entry->applications()) |
| 235 AddEntryToCatalog(make_scoped_ptr(child), is_system_catalog); | 237 AddEntryToCatalog(make_scoped_ptr(child), is_system_catalog); |
| 236 (*catalog)[entry->name()] = std::move(entry); | 238 (*catalog)[entry->name()] = std::move(entry); |
| 237 SerializeCatalog(); | 239 SerializeCatalog(); |
| 238 } | 240 } |
| 239 | 241 |
| 240 } // namespace catalog | 242 } // namespace catalog |
| OLD | NEW |