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/catalog.h" | 5 #include "services/catalog/catalog.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 void Catalog::ScanSystemPackageDir() { | 98 void Catalog::ScanSystemPackageDir() { |
99 base::FilePath system_package_dir; | 99 base::FilePath system_package_dir; |
100 PathService::Get(base::DIR_MODULE, &system_package_dir); | 100 PathService::Get(base::DIR_MODULE, &system_package_dir); |
101 system_package_dir = system_package_dir.AppendASCII(kPackagesDirName); | 101 system_package_dir = system_package_dir.AppendASCII(kPackagesDirName); |
102 system_reader_->Read(system_package_dir, &system_cache_, | 102 system_reader_->Read(system_package_dir, &system_cache_, |
103 base::Bind(&Catalog::SystemPackageDirScanned, | 103 base::Bind(&Catalog::SystemPackageDirScanned, |
104 weak_factory_.GetWeakPtr())); | 104 weak_factory_.GetWeakPtr())); |
105 } | 105 } |
106 | 106 |
107 bool Catalog::OnConnect(shell::Connection* connection) { | 107 bool Catalog::OnConnect(const shell::Identity& remote_identity, |
108 connection->AddInterface<mojom::Catalog>(this); | 108 shell::InterfaceRegistry* registry) { |
109 connection->AddInterface<filesystem::mojom::Directory>(this); | 109 registry->AddInterface<mojom::Catalog>(this); |
110 connection->AddInterface<shell::mojom::Resolver>(this); | 110 registry->AddInterface<filesystem::mojom::Directory>(this); |
| 111 registry->AddInterface<shell::mojom::Resolver>(this); |
111 return true; | 112 return true; |
112 } | 113 } |
113 | 114 |
114 void Catalog::Create(const shell::Identity& remote_identity, | 115 void Catalog::Create(const shell::Identity& remote_identity, |
115 shell::mojom::ResolverRequest request) { | 116 shell::mojom::ResolverRequest request) { |
116 Instance* instance = GetInstanceForUserId(remote_identity.user_id()); | 117 Instance* instance = GetInstanceForUserId(remote_identity.user_id()); |
117 instance->BindResolver(std::move(request)); | 118 instance->BindResolver(std::move(request)); |
118 } | 119 } |
119 | 120 |
120 void Catalog::Create(const shell::Identity& remote_identity, | 121 void Catalog::Create(const shell::Identity& remote_identity, |
(...skipping 27 matching lines...) Expand all Loading... |
148 return instance; | 149 return instance; |
149 } | 150 } |
150 | 151 |
151 void Catalog::SystemPackageDirScanned() { | 152 void Catalog::SystemPackageDirScanned() { |
152 loaded_ = true; | 153 loaded_ = true; |
153 for (auto& instance : instances_) | 154 for (auto& instance : instances_) |
154 instance.second->CacheReady(&system_cache_); | 155 instance.second->CacheReady(&system_cache_); |
155 } | 156 } |
156 | 157 |
157 } // namespace catalog | 158 } // namespace catalog |
OLD | NEW |