OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "mandoline/services/updater/updater_impl.h" | 5 #include "mandoline/services/updater/updater_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "mandoline/services/updater/updater_app.h" | 11 #include "mandoline/services/updater/updater_app.h" |
12 #include "mojo/shell/public/cpp/application_impl.h" | 12 #include "mojo/shell/public/cpp/shell_connection.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace updater { | 15 namespace updater { |
16 | 16 |
17 UpdaterImpl::UpdaterImpl(UpdaterApp* application, | 17 UpdaterImpl::UpdaterImpl(UpdaterApp* application, |
18 mojo::InterfaceRequest<Updater> request) | 18 mojo::InterfaceRequest<Updater> request) |
19 : application_(application), | 19 : application_(application), |
20 binding_(this, std::move(request)) {} | 20 binding_(this, std::move(request)) {} |
21 | 21 |
22 UpdaterImpl::~UpdaterImpl() { | 22 UpdaterImpl::~UpdaterImpl() { |
23 } | 23 } |
24 | 24 |
25 void UpdaterImpl::GetPathForApp( | 25 void UpdaterImpl::GetPathForApp( |
26 const mojo::String& url, | 26 const mojo::String& url, |
27 const Updater::GetPathForAppCallback& callback) { | 27 const Updater::GetPathForAppCallback& callback) { |
28 // TODO(scottmg): For now, just stub to local files. This will become an | 28 // TODO(scottmg): For now, just stub to local files. This will become an |
29 // integration with components/update_client. | 29 // integration with components/update_client. |
30 base::FilePath shell_dir; | 30 base::FilePath shell_dir; |
31 PathService::Get(base::DIR_MODULE, &shell_dir); | 31 PathService::Get(base::DIR_MODULE, &shell_dir); |
32 const GURL as_url(url.get()); | 32 const GURL as_url(url.get()); |
33 const base::FilePath path = shell_dir.Append(base::FilePath::FromUTF8Unsafe( | 33 const base::FilePath path = shell_dir.Append(base::FilePath::FromUTF8Unsafe( |
34 as_url.path().substr(2, as_url.path().size() - 3) + ".mojo")); | 34 as_url.path().substr(2, as_url.path().size() - 3) + ".mojo")); |
35 callback.Run(path.AsUTF8Unsafe()); | 35 callback.Run(path.AsUTF8Unsafe()); |
36 } | 36 } |
37 | 37 |
38 } // namespace updater | 38 } // namespace updater |
OLD | NEW |