Commit 41b5475d authored by Nigel Tao's avatar Nigel Tao Committed by Commit Bot

Factor simple C++ types out of crostini_manager.h

This means that the sync_integration_tests code can include e.g. App
Service code without leading to a "#include <dbus/dbus.h>" dependency.
Without this change:

In file included from ../../chrome/browser/apps/app_service/app_service_proxy_impl.h:18:
In file included from ../../chrome/browser/apps/app_service/crostini_apps.h:15:
In file included from ../../chrome/browser/chromeos/crostini/crostini_registry_service.h:18:
In file included from ../../chrome/browser/chromeos/crostini/crostini_manager.h:23:
In file included from ../../chromeos/dbus/cicerone_client.h:14:
../../dbus/object_proxy.h:8:10: fatal error: 'dbus/dbus.h' file not found

Change-Id: I71b4a54ebd7e2ddef05d84c20e1e19826c86f392
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1688366
Commit-Queue: Nigel Tao <nigeltao@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#676621}
parent 7ecb3513
...@@ -736,6 +736,7 @@ source_set("chromeos") { ...@@ -736,6 +736,7 @@ source_set("chromeos") {
"crostini/crostini_remover.h", "crostini/crostini_remover.h",
"crostini/crostini_reporting_util.cc", "crostini/crostini_reporting_util.cc",
"crostini/crostini_reporting_util.h", "crostini/crostini_reporting_util.h",
"crostini/crostini_simple_types.h",
"crostini/crostini_terminal.cc", "crostini/crostini_terminal.cc",
"crostini/crostini_terminal.h", "crostini/crostini_terminal.h",
"crostini/crostini_util.cc", "crostini/crostini_util.cc",
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/optional.h" #include "base/optional.h"
#include "chrome/browser/chromeos/crostini/crostini_simple_types.h"
#include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/crostini/crostini_util.h"
#include "chrome/browser/component_updater/cros_component_installer_chromeos.h" #include "chrome/browser/component_updater/cros_component_installer_chromeos.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
...@@ -29,137 +30,6 @@ class Profile; ...@@ -29,137 +30,6 @@ class Profile;
namespace crostini { namespace crostini {
// Result types for various callbacks etc.
// WARNING: Do not remove or re-order these values, as they are used in user
// visible error messages and logs. New entries should only be added to the end.
// This message was added during development of M74, error codes from prior
// versions may differ from the numbering here.
enum class CrostiniResult {
SUCCESS = 0,
// DBUS_ERROR = 1,
// UNPARSEABLE_RESPONSE = 2,
// INSUFFICIENT_DISK = 3,
CREATE_DISK_IMAGE_FAILED = 4,
VM_START_FAILED = 5,
VM_STOP_FAILED = 6,
DESTROY_DISK_IMAGE_FAILED = 7,
LIST_VM_DISKS_FAILED = 8,
CLIENT_ERROR = 9,
// DISK_TYPE_ERROR = 10,
CONTAINER_DOWNLOAD_TIMED_OUT = 11,
CONTAINER_CREATE_CANCELLED = 12,
CONTAINER_CREATE_FAILED = 13,
CONTAINER_START_CANCELLED = 14,
CONTAINER_START_FAILED = 15,
// LAUNCH_CONTAINER_APPLICATION_FAILED = 16,
INSTALL_LINUX_PACKAGE_FAILED = 17,
BLOCKING_OPERATION_ALREADY_ACTIVE = 18,
UNINSTALL_PACKAGE_FAILED = 19,
// SSHFS_MOUNT_ERROR = 20,
OFFLINE_WHEN_UPGRADE_REQUIRED = 21,
LOAD_COMPONENT_FAILED = 22,
// PERMISSION_BROKER_ERROR = 23,
// ATTACH_USB_FAILED = 24,
// DETACH_USB_FAILED = 25,
// LIST_USB_FAILED = 26,
CROSTINI_UNINSTALLER_RUNNING = 27,
// UNKNOWN_USB_DEVICE = 28,
UNKNOWN_ERROR = 29,
CONTAINER_EXPORT_IMPORT_FAILED = 30,
CONTAINER_EXPORT_IMPORT_FAILED_VM_STOPPED = 31,
CONTAINER_EXPORT_IMPORT_FAILED_VM_STARTED = 32,
CONTAINER_EXPORT_IMPORT_FAILED_ARCHITECTURE = 33,
NOT_ALLOWED = 34,
CONTAINER_EXPORT_IMPORT_FAILED_SPACE = 35,
GET_CONTAINER_SSH_KEYS_FAILED = 36,
};
enum class InstallLinuxPackageProgressStatus {
SUCCEEDED,
FAILED,
DOWNLOADING,
INSTALLING,
};
enum class VmState {
STARTING,
STARTED,
STOPPING,
};
enum class UninstallPackageProgressStatus {
SUCCEEDED,
FAILED,
UNINSTALLING, // In progress
};
// TODO(juwa): delete this once the new version of tremplin has shipped.
enum class ExportContainerProgressStatus {
// Deprecated. Has been replaced by STREAMING.
PACK,
// Deprecated. Has been replaced by STREAMING.
DOWNLOAD,
STREAMING,
};
enum class ImportContainerProgressStatus {
UPLOAD,
UNPACK,
FAILURE_ARCHITECTURE,
FAILURE_SPACE,
};
struct VmInfo {
VmState state;
vm_tools::concierge::VmInfo info;
};
struct StreamingExportStatus {
uint32_t total_files;
uint64_t total_bytes;
uint32_t exported_files;
uint64_t exported_bytes;
};
struct ContainerInfo {
ContainerInfo(std::string name, std::string username, std::string homedir);
~ContainerInfo();
ContainerInfo(const ContainerInfo&);
std::string name;
std::string username;
base::FilePath homedir;
bool sshfs_mounted = false;
};
// Return type when getting app icons from within a container.
struct Icon {
std::string desktop_file_id;
// Icon file content in PNG format.
std::string content;
};
struct LinuxPackageInfo {
LinuxPackageInfo();
LinuxPackageInfo(const LinuxPackageInfo&);
~LinuxPackageInfo();
bool success;
// A textual reason for the failure, only set when success is false.
std::string failure_reason;
// The remaining fields are only set when success is true.
// package_id is given as "name;version;arch;data".
std::string package_id;
std::string name;
std::string version;
std::string summary;
std::string description;
};
class LinuxPackageOperationProgressObserver { class LinuxPackageOperationProgressObserver {
public: public:
// A successfully started package install will continually fire progress // A successfully started package install will continually fire progress
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/time/default_clock.h" #include "base/time/default_clock.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/crostini/crostini_manager.h"
#include "chrome/browser/chromeos/crostini/crostini_pref_names.h" #include "chrome/browser/chromeos/crostini/crostini_pref_names.h"
#include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/crostini/crostini_util.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/chromeos/crostini/crostini_manager.h" #include "chrome/browser/chromeos/crostini/crostini_simple_types.h"
#include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/core/keyed_service.h"
#include "ui/base/resource/scale_factor.h" #include "ui/base/resource/scale_factor.h"
......
// Copyright 2018 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.
#ifndef CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_SIMPLE_TYPES_H_
#define CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_SIMPLE_TYPES_H_
#include <string>
#include "base/files/file_path.h"
#include "chromeos/dbus/concierge/service.pb.h"
// This file contains simple C++ types (enums and Plain-Old-Data structs).
// Importantly, #include'ing this file will not depend on eventually executing
// "#include <dbus/dbus.h>",
namespace crostini {
// Result types for various callbacks etc.
// WARNING: Do not remove or re-order these values, as they are used in user
// visible error messages and logs. New entries should only be added to the end.
// This message was added during development of M74, error codes from prior
// versions may differ from the numbering here.
enum class CrostiniResult {
SUCCESS = 0,
// DBUS_ERROR = 1,
// UNPARSEABLE_RESPONSE = 2,
// INSUFFICIENT_DISK = 3,
CREATE_DISK_IMAGE_FAILED = 4,
VM_START_FAILED = 5,
VM_STOP_FAILED = 6,
DESTROY_DISK_IMAGE_FAILED = 7,
LIST_VM_DISKS_FAILED = 8,
CLIENT_ERROR = 9,
// DISK_TYPE_ERROR = 10,
CONTAINER_DOWNLOAD_TIMED_OUT = 11,
CONTAINER_CREATE_CANCELLED = 12,
CONTAINER_CREATE_FAILED = 13,
CONTAINER_START_CANCELLED = 14,
CONTAINER_START_FAILED = 15,
// LAUNCH_CONTAINER_APPLICATION_FAILED = 16,
INSTALL_LINUX_PACKAGE_FAILED = 17,
BLOCKING_OPERATION_ALREADY_ACTIVE = 18,
UNINSTALL_PACKAGE_FAILED = 19,
// SSHFS_MOUNT_ERROR = 20,
OFFLINE_WHEN_UPGRADE_REQUIRED = 21,
LOAD_COMPONENT_FAILED = 22,
// PERMISSION_BROKER_ERROR = 23,
// ATTACH_USB_FAILED = 24,
// DETACH_USB_FAILED = 25,
// LIST_USB_FAILED = 26,
CROSTINI_UNINSTALLER_RUNNING = 27,
// UNKNOWN_USB_DEVICE = 28,
UNKNOWN_ERROR = 29,
CONTAINER_EXPORT_IMPORT_FAILED = 30,
CONTAINER_EXPORT_IMPORT_FAILED_VM_STOPPED = 31,
CONTAINER_EXPORT_IMPORT_FAILED_VM_STARTED = 32,
CONTAINER_EXPORT_IMPORT_FAILED_ARCHITECTURE = 33,
NOT_ALLOWED = 34,
CONTAINER_EXPORT_IMPORT_FAILED_SPACE = 35,
GET_CONTAINER_SSH_KEYS_FAILED = 36,
};
enum class InstallLinuxPackageProgressStatus {
SUCCEEDED,
FAILED,
DOWNLOADING,
INSTALLING,
};
enum class VmState {
STARTING,
STARTED,
STOPPING,
};
enum class UninstallPackageProgressStatus {
SUCCEEDED,
FAILED,
UNINSTALLING, // In progress
};
// TODO(juwa): delete this once the new version of tremplin has shipped.
enum class ExportContainerProgressStatus {
// Deprecated. Has been replaced by STREAMING.
PACK,
// Deprecated. Has been replaced by STREAMING.
DOWNLOAD,
STREAMING,
};
enum class ImportContainerProgressStatus {
UPLOAD,
UNPACK,
FAILURE_ARCHITECTURE,
FAILURE_SPACE,
};
struct VmInfo {
VmState state;
vm_tools::concierge::VmInfo info;
};
struct StreamingExportStatus {
uint32_t total_files;
uint64_t total_bytes;
uint32_t exported_files;
uint64_t exported_bytes;
};
struct ContainerInfo {
ContainerInfo(std::string name, std::string username, std::string homedir);
~ContainerInfo();
ContainerInfo(const ContainerInfo&);
std::string name;
std::string username;
base::FilePath homedir;
bool sshfs_mounted = false;
};
// Return type when getting app icons from within a container.
struct Icon {
std::string desktop_file_id;
// Icon file content in PNG format.
std::string content;
};
struct LinuxPackageInfo {
LinuxPackageInfo();
LinuxPackageInfo(const LinuxPackageInfo&);
~LinuxPackageInfo();
bool success;
// A textual reason for the failure, only set when success is false.
std::string failure_reason;
// The remaining fields are only set when success is true.
// package_id is given as "name;version;arch;data".
std::string package_id;
std::string name;
std::string version;
std::string summary;
std::string description;
};
} // namespace crostini
#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_SIMPLE_TYPES_H_
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "ash/public/cpp/app_menu_constants.h" #include "ash/public/cpp/app_menu_constants.h"
#include "ash/public/cpp/shelf_item.h" #include "ash/public/cpp/shelf_item.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "chrome/browser/chromeos/crostini/crostini_manager.h"
#include "chrome/browser/chromeos/crostini/crostini_registry_service.h" #include "chrome/browser/chromeos/crostini/crostini_registry_service.h"
#include "chrome/browser/chromeos/crostini/crostini_registry_service_factory.h" #include "chrome/browser/chromeos/crostini/crostini_registry_service_factory.h"
#include "chrome/browser/chromeos/crostini/crostini_util.h" #include "chrome/browser/chromeos/crostini/crostini_util.h"
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/test/bind_test_util.h" #include "base/test/bind_test_util.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/chromeos/arc/icon_decode_request.h" #include "chrome/browser/chromeos/arc/icon_decode_request.h"
#include "chrome/browser/chromeos/crostini/crostini_manager.h"
#include "chrome/browser/chromeos/crostini/crostini_registry_service.h" #include "chrome/browser/chromeos/crostini/crostini_registry_service.h"
#include "chrome/browser/chromeos/crostini/crostini_registry_service_factory.h" #include "chrome/browser/chromeos/crostini/crostini_registry_service_factory.h"
#include "chrome/browser/chromeos/crostini/crostini_test_helper.h" #include "chrome/browser/chromeos/crostini/crostini_test_helper.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment