#include "chrome/browser/apps/app_service/publishers/app_publisher.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "components/services/app_service/public/cpp/capability_access.h"
#include "components/services/app_service/public/cpp/package_id.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/apps/app_service/promise_apps/promise_app.h"
#include "extensions/grit/extensions_browser_resources.h"
#endif
namespace apps {
AppPublisher::AppPublisher(AppServiceProxy* proxy) : … { … }
AppPublisher::~AppPublisher() = default;
AppPtr AppPublisher::MakeApp(AppType app_type,
const std::string& app_id,
Readiness readiness,
const std::string& name,
InstallReason install_reason,
InstallSource install_source) { … }
#if !BUILDFLAG(IS_CHROMEOS_LACROS)
void AppPublisher::RegisterPublisher(AppType app_type) { … }
#endif
void AppPublisher::LoadIcon(const std::string& app_id,
const IconKey& icon_key,
apps::IconType icon_type,
int32_t size_hint_in_dip,
bool allow_placeholder_icon,
LoadIconCallback callback) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
int AppPublisher::DefaultIconResourceId() const {
return IDR_APP_DEFAULT_ICON;
}
void AppPublisher::GetCompressedIconData(const std::string& app_id,
int32_t size_in_dip,
ui::ResourceScaleFactor scale_factor,
LoadIconCallback callback) {
std::move(callback).Run(std::make_unique<IconValue>());
}
#endif
void AppPublisher::LaunchAppWithFiles(const std::string& app_id,
int32_t event_flags,
LaunchSource launch_source,
std::vector<base::FilePath> file_paths) { … }
void AppPublisher::LaunchAppWithIntent(const std::string& app_id,
int32_t event_flags,
IntentPtr intent,
LaunchSource launch_source,
WindowInfoPtr window_info,
LaunchCallback callback) { … }
void AppPublisher::SetPermission(const std::string& app_id,
PermissionPtr permission) { … }
void AppPublisher::Uninstall(const std::string& app_id,
UninstallSource uninstall_source,
bool clear_site_data,
bool report_abuse) { … }
void AppPublisher::PauseApp(const std::string& app_id) { … }
void AppPublisher::UnpauseApp(const std::string& app_id) { … }
void AppPublisher::BlockApp(const std::string& app_id) { … }
void AppPublisher::UnblockApp(const std::string& app_id) { … }
void AppPublisher::StopApp(const std::string& app_id) { … }
void AppPublisher::GetMenuModel(const std::string& app_id,
MenuType menu_type,
int64_t display_id,
base::OnceCallback<void(MenuItems)> callback) { … }
void AppPublisher::UpdateAppSize(const std::string& app_id) { … }
void AppPublisher::ExecuteContextMenuCommand(const std::string& app_id,
int command_id,
const std::string& shortcut_id,
int64_t display_id) { … }
void AppPublisher::OpenNativeSettings(const std::string& app_id) { … }
void AppPublisher::SetResizeLocked(const std::string& app_id, bool locked) { … }
void AppPublisher::SetWindowMode(const std::string& app_id,
WindowMode window_mode) { … }
#if BUILDFLAG(IS_CHROMEOS_ASH)
void AppPublisher::SetAppLocale(const std::string& app_id,
const std::string& locale_tag) {
NOTIMPLEMENTED();
}
PromiseAppPtr AppPublisher::MakePromiseApp(const PackageId& package_id) {
return std::make_unique<PromiseApp>(package_id);
}
void AppPublisher::PublishPromiseApp(PromiseAppPtr delta) {
if (!proxy_) {
NOTREACHED_IN_MIGRATION();
return;
}
proxy_->OnPromiseApp(std::move(delta));
}
#endif
#if !BUILDFLAG(IS_CHROMEOS_LACROS)
void AppPublisher::Publish(AppPtr app) { … }
void AppPublisher::Publish(std::vector<AppPtr> apps,
AppType app_type,
bool should_notify_initialized) { … }
void AppPublisher::ModifyCapabilityAccess(
const std::string& app_id,
std::optional<bool> accessing_camera,
std::optional<bool> accessing_microphone) { … }
void AppPublisher::ResetCapabilityAccess(AppType app_type) { … }
#endif
}