Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(535)

Side by Side Diff: services/catalog/catalog.cc

Issue 2172673002: Move Service packages from Mojo Applications -> Packages dir (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mash/example/window_type_launcher/BUILD.gn ('k') | services/catalog/constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 size_t end_of_name = path.find('/'); 54 size_t end_of_name = path.find('/');
55 if (end_of_name != std::string::npos) 55 if (end_of_name != std::string::npos)
56 path.erase(path.begin() + end_of_name, path.end()); 56 path.erase(path.begin() + end_of_name, path.end());
57 57
58 if (!IsPathNameValid(path)) 58 if (!IsPathNameValid(path))
59 return base::FilePath(); 59 return base::FilePath();
60 60
61 base::FilePath base_path; 61 base::FilePath base_path;
62 PathService::Get(base::DIR_EXE, &base_path); 62 PathService::Get(base::DIR_EXE, &base_path);
63 // TODO(beng): this won't handle user-specific components. 63 // TODO(beng): this won't handle user-specific components.
64 return base_path.AppendASCII(kMojoApplicationsDirName).AppendASCII(path). 64 return base_path.AppendASCII(kPackagesDirName).AppendASCII(path).
65 AppendASCII("resources"); 65 AppendASCII("resources");
66 } 66 }
67 67
68 } // namespace 68 } // namespace
69 69
70 Catalog::Catalog(base::SequencedWorkerPool* worker_pool, 70 Catalog::Catalog(base::SequencedWorkerPool* worker_pool,
71 std::unique_ptr<Store> store, 71 std::unique_ptr<Store> store,
72 ManifestProvider* manifest_provider) 72 ManifestProvider* manifest_provider)
73 : Catalog(std::move(store)) { 73 : Catalog(std::move(store)) {
74 system_reader_.reset(new Reader(worker_pool, manifest_provider)); 74 system_reader_.reset(new Reader(worker_pool, manifest_provider));
(...skipping 16 matching lines...) Expand all
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::ServiceRequest request = GetProxy(&service_); 94 shell::mojom::ServiceRequest request = GetProxy(&service_);
95 shell_connection_.reset(new shell::ServiceContext(this, std::move(request))); 95 shell_connection_.reset(new shell::ServiceContext(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(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(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::Resolver>(this); 110 connection->AddInterface<shell::mojom::Resolver>(this);
111 return true; 111 return true;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « mash/example/window_type_launcher/BUILD.gn ('k') | services/catalog/constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698