blob: 4b107ec3f4c10e44daf9815132a879877a62c5dd [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "chromeos/dbus/vm_plugin_dispatcher/vm_plugin_dispatcher.pb.h"
#include "components/keyed_service/core/keyed_service.h"
class Profile;
namespace plugin_vm {
extern const char kPluginVmDefaultName[];
// The PluginVmManager is responsible for connecting to the D-Bus services to
// manage the Plugin Vm.
class PluginVmManager : public KeyedService {
static PluginVmManager* GetForProfile(Profile* profile);
explicit PluginVmManager(Profile* profile);
~PluginVmManager() override;
void LaunchPluginVm();
void StopPluginVm();
// The flow to launch a Plugin Vm. We'll probably want to add additional
// abstraction around starting the services in the future but this is
// sufficient for now.
void OnStartPluginVmDispatcher(bool success);
void OnListVms(
base::Optional<vm_tools::plugin_dispatcher::ListVmResponse> reply);
void OnStartVm(
base::Optional<vm_tools::plugin_dispatcher::StartVmResponse> reply);
void ShowVm();
void OnShowVm(
base::Optional<vm_tools::plugin_dispatcher::ShowVmResponse> reply);
Profile* profile_;
std::string owner_id_;
base::WeakPtrFactory<PluginVmManager> weak_ptr_factory_;
} // namespace plugin_vm