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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 Catalog::Catalog(base::SingleThreadTaskRunner* task_runner, | 78 Catalog::Catalog(base::SingleThreadTaskRunner* task_runner, |
79 std::unique_ptr<Store> store, | 79 std::unique_ptr<Store> store, |
80 ManifestProvider* manifest_provider) | 80 ManifestProvider* manifest_provider) |
81 : Catalog(std::move(store)) { | 81 : Catalog(std::move(store)) { |
82 system_reader_.reset(new Reader(task_runner, manifest_provider)); | 82 system_reader_.reset(new Reader(task_runner, manifest_provider)); |
83 ScanSystemPackageDir(); | 83 ScanSystemPackageDir(); |
84 } | 84 } |
85 | 85 |
86 Catalog::~Catalog() {} | 86 Catalog::~Catalog() {} |
87 | 87 |
88 shell::mojom::ShellClientPtr Catalog::TakeShellClient() { | 88 shell::mojom::ServicePtr Catalog::TakeService() { |
89 return std::move(shell_client_); | 89 return std::move(service_); |
90 } | 90 } |
91 | 91 |
92 Catalog::Catalog(std::unique_ptr<Store> store) | 92 Catalog::Catalog(std::unique_ptr<Store> store) |
93 : store_(std::move(store)), weak_factory_(this) { | 93 : store_(std::move(store)), weak_factory_(this) { |
94 shell::mojom::ShellClientRequest request = GetProxy(&shell_client_); | 94 shell::mojom::ServiceRequest request = GetProxy(&service_); |
95 shell_connection_.reset(new shell::ShellConnection(this, std::move(request))); | 95 shell_connection_.reset(new shell::ShellConnection(this, std::move(request))); |
96 } | 96 } |
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(kMojoApplicationsDirName); | 101 system_package_dir = system_package_dir.AppendASCII(kMojoApplicationsDirName); |
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::AcceptConnection(shell::Connection* connection) { | 107 bool Catalog::OnConnect(shell::Connection* connection) { |
108 connection->AddInterface<mojom::Catalog>(this); | 108 connection->AddInterface<mojom::Catalog>(this); |
109 connection->AddInterface<filesystem::mojom::Directory>(this); | 109 connection->AddInterface<filesystem::mojom::Directory>(this); |
110 connection->AddInterface<shell::mojom::ShellResolver>(this); | 110 connection->AddInterface<shell::mojom::ShellResolver>(this); |
111 return true; | 111 return true; |
112 } | 112 } |
113 | 113 |
114 void Catalog::Create(shell::Connection* connection, | 114 void Catalog::Create(shell::Connection* connection, |
115 shell::mojom::ShellResolverRequest request) { | 115 shell::mojom::ShellResolverRequest request) { |
116 Instance* instance = | 116 Instance* instance = |
117 GetInstanceForUserId(connection->GetRemoteIdentity().user_id()); | 117 GetInstanceForUserId(connection->GetRemoteIdentity().user_id()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return instance; | 150 return instance; |
151 } | 151 } |
152 | 152 |
153 void Catalog::SystemPackageDirScanned() { | 153 void Catalog::SystemPackageDirScanned() { |
154 loaded_ = true; | 154 loaded_ = true; |
155 for (auto& instance : instances_) | 155 for (auto& instance : instances_) |
156 instance.second->CacheReady(&system_cache_); | 156 instance.second->CacheReady(&system_cache_); |
157 } | 157 } |
158 | 158 |
159 } // namespace catalog | 159 } // namespace catalog |
OLD | NEW |