| 1 |
/* |
| 2 |
* Copyright © 2016 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software: you can redistribute it and/or modify it |
| 5 |
* under the terms of the GNU General Public License version 3, as published |
| 6 |
* by the Free Software Foundation. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, but |
| 9 |
* WITHOUT ANY WARRANTY; without even the implied warranties of |
| 10 |
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 11 |
* PURPOSE. See the GNU General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU General Public License along |
| 14 |
* with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
* |
| 16 |
* Authors: |
| 17 |
* Ted Gould <[email protected]> |
| 18 |
*/ |
| 19 |
|
| 20 |
#pragma once |
| 21 |
|
| 22 |
#include "application-info-desktop.h" |
| 23 |
#include "application.h" |
| 24 |
#include "registry-impl.h" |
| 25 |
#include "registry.h" |
| 26 |
|
| 27 |
namespace lomiri |
| 28 |
{ |
| 29 |
namespace app_launch |
| 30 |
{ |
| 31 |
namespace app_info |
| 32 |
{ |
| 33 |
class Desktop; |
| 34 |
} |
| 35 |
namespace app_impls |
| 36 |
{ |
| 37 |
|
| 38 |
/** Provides some helper functions that can be used by all |
| 39 |
implementations of application. Stores the registry pointer |
| 40 |
which everyone wants anyway. */ |
| 41 |
class Base : public lomiri::app_launch::Application |
| 42 |
{ |
| 43 |
public: |
| 44 |
Base(const std::shared_ptr<Registry::Impl>& registry); |
| 45 |
virtual ~Base(); |
| 46 |
|
| 47 |
bool hasInstances() override; |
| 48 |
|
| 49 |
std::string getInstance(const std::shared_ptr<app_info::Desktop>& desktop) const; |
| 50 |
virtual std::shared_ptr<Application::Instance> findInstance(const std::string& instanceid) = 0; |
| 51 |
std::shared_ptr<Application::Instance> findInstance(const pid_t& pid); |
| 52 |
|
| 53 |
protected: |
| 54 |
/** Pointer to the registry so we can ask it for things */ |
| 55 |
std::shared_ptr<Registry::Impl> registry_; |
| 56 |
|
| 57 |
static std::list<std::pair<std::string, std::string>> confinedEnv(const std::string& package, |
| 58 |
const std::string& pkgdir); |
| 59 |
}; |
| 60 |
|
| 61 |
} // namespace app_impls |
| 62 |
} // namespace app_launch |
| 63 |
} // namespace lomiri |