| 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/factory.h" | 5 #include "mojo/services/catalog/factory.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "mojo/services/catalog/catalog.h" | 8 #include "mojo/services/catalog/catalog.h" |
| 9 #include "mojo/shell/public/cpp/connection.h" | 9 #include "mojo/shell/public/cpp/connection.h" |
| 10 #include "mojo/shell/public/cpp/shell_connection.h" | 10 #include "mojo/shell/public/cpp/shell_connection.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 GetCatalogForUserId(connection->GetRemoteIdentity().user_id()); | 51 GetCatalogForUserId(connection->GetRemoteIdentity().user_id()); |
| 52 instance->BindCatalog(std::move(request)); | 52 instance->BindCatalog(std::move(request)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 Catalog* Factory::GetCatalogForUserId(const std::string& user_id) { | 55 Catalog* Factory::GetCatalogForUserId(const std::string& user_id) { |
| 56 auto it = catalogs_.find(user_id); | 56 auto it = catalogs_.find(user_id); |
| 57 if (it != catalogs_.end()) | 57 if (it != catalogs_.end()) |
| 58 return it->second.get(); | 58 return it->second.get(); |
| 59 | 59 |
| 60 // TODO(beng): There needs to be a way to load the store from different users. | 60 // TODO(beng): There needs to be a way to load the store from different users. |
| 61 Catalog* instance = new Catalog(std::move(store_), file_task_runner_); | 61 Catalog* instance = |
| 62 new Catalog(std::move(store_), file_task_runner_, &system_catalog_); |
| 62 catalogs_[user_id] = make_scoped_ptr(instance); | 63 catalogs_[user_id] = make_scoped_ptr(instance); |
| 63 return instance; | 64 return instance; |
| 64 } | 65 } |
| 65 | 66 |
| 66 } // namespace catalog | 67 } // namespace catalog |
| OLD | NEW |