Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / mandoline / services / updater / updater_impl.cc
blobe91b351887001a3bf08083d9c5dc001b42bdd425
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
3 // found in the LICENSE file.
5 #include "mandoline/services/updater/updater_impl.h"
7 #include "base/files/file_util.h"
8 #include "base/path_service.h"
9 #include "mandoline/services/updater/updater_app.h"
10 #include "mojo/application/public/cpp/application_impl.h"
11 #include "url/gurl.h"
13 namespace updater {
15 UpdaterImpl::UpdaterImpl(mojo::ApplicationImpl* app_impl,
16 UpdaterApp* application,
17 mojo::InterfaceRequest<Updater> request)
18 : application_(application),
19 app_impl_(app_impl),
20 binding_(this, request.Pass()) {
23 UpdaterImpl::~UpdaterImpl() {
26 void UpdaterImpl::GetPathForApp(
27 const mojo::String& url,
28 const Updater::GetPathForAppCallback& callback) {
29 // TODO(scottmg): For now, just stub to local files. This will become an
30 // integration with components/update_client.
31 base::FilePath shell_dir;
32 PathService::Get(base::DIR_MODULE, &shell_dir);
33 const GURL as_url(url);
34 const base::FilePath path = shell_dir.Append(base::FilePath::FromUTF8Unsafe(
35 as_url.path().substr(2, as_url.path().size() - 3) + ".mojo"));
36 callback.Run(path.AsUTF8Unsafe());
39 } // namespace updater