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

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

Issue 1846953004: Reader (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@60subdir
Patch Set: . Created 4 years, 8 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 | « mojo/services/catalog/factory.h ('k') | mojo/services/catalog/reader.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 "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"
11 11
12 namespace catalog { 12 namespace catalog {
13 13
14 Factory::Factory(base::TaskRunner* file_task_runner, scoped_ptr<Store> store) 14 Factory::Factory(base::TaskRunner* file_task_runner, scoped_ptr<Store> store)
15 : file_task_runner_(file_task_runner), 15 : file_task_runner_(file_task_runner),
16 store_(std::move(store)), 16 store_(std::move(store)),
17 weak_factory_(this) { 17 weak_factory_(this) {
18 mojo::shell::mojom::ShellClientRequest request = GetProxy(&shell_client_); 18 mojo::shell::mojom::ShellClientRequest request = GetProxy(&shell_client_);
19 shell_connection_.reset(new mojo::ShellConnection(this, std::move(request))); 19 shell_connection_.reset(new mojo::ShellConnection(this, std::move(request)));
20
21 base::FilePath system_package_dir;
22 PathService::Get(base::DIR_MODULE, &system_package_dir);
23 reader_.reset(new Reader(
24 &system_catalog_,
25 file_task_runner_,
26 system_package_dir.Append(FILE_PATH_LITERAL("Mojo Applications"))));
27 reader_->ReadAllManifests();
20 } 28 }
21 Factory::~Factory() {} 29 Factory::~Factory() {}
22 30
23 mojo::shell::mojom::ShellClientPtr Factory::TakeShellClient() { 31 mojo::shell::mojom::ShellClientPtr Factory::TakeShellClient() {
24 return std::move(shell_client_); 32 return std::move(shell_client_);
25 } 33 }
26 34
27 bool Factory::AcceptConnection(mojo::Connection* connection) { 35 bool Factory::AcceptConnection(mojo::Connection* connection) {
28 connection->AddInterface<mojom::Catalog>(this); 36 connection->AddInterface<mojom::Catalog>(this);
29 connection->AddInterface<mojom::Resolver>(this); 37 connection->AddInterface<mojom::Resolver>(this);
(...skipping 28 matching lines...) Expand all
58 return it->second.get(); 66 return it->second.get();
59 67
60 // TODO(beng): There needs to be a way to load the store from different users. 68 // TODO(beng): There needs to be a way to load the store from different users.
61 Catalog* instance = 69 Catalog* instance =
62 new Catalog(std::move(store_), file_task_runner_, &system_catalog_); 70 new Catalog(std::move(store_), file_task_runner_, &system_catalog_);
63 catalogs_[user_id] = make_scoped_ptr(instance); 71 catalogs_[user_id] = make_scoped_ptr(instance);
64 return instance; 72 return instance;
65 } 73 }
66 74
67 } // namespace catalog 75 } // namespace catalog
OLDNEW
« no previous file with comments | « mojo/services/catalog/factory.h ('k') | mojo/services/catalog/reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698