#include "chrome/browser/apps/app_service/app_service_proxy_base.h"
#include <stddef.h>
#include <map>
#include <type_traits>
#include <utility>
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "chrome/browser/apps/app_service/app_icon_source.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/apps/app_service/browser_app_launcher.h"
#include "chrome/browser/apps/app_service/metrics/app_service_metrics.h"
#include "chrome/browser/apps/app_service/publishers/app_publisher.h"
#include "chrome/browser/profiles/profile.h"
#include "components/services/app_service/public/cpp/app_launch_util.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/services/app_service/public/cpp/app_update.h"
#include "components/services/app_service/public/cpp/features.h"
#include "components/services/app_service/public/cpp/icon_effects.h"
#include "components/services/app_service/public/cpp/intent.h"
#include "components/services/app_service/public/cpp/intent_filter.h"
#include "components/services/app_service/public/cpp/intent_filter_util.h"
#include "components/services/app_service/public/cpp/intent_util.h"
#include "components/services/app_service/public/cpp/preferred_app.h"
#include "components/services/app_service/public/cpp/types_util.h"
#include "content/public/browser/url_data_source.h"
#include "url/gurl.h"
namespace apps {
class PreferredAppsListHandle;
namespace {
struct IndexAndGeneric { … };
std::string GetActivityLabel(const IntentFilterPtr& filter,
const AppUpdate& update) { … }
}
AppServiceProxyBase::AppInnerIconLoader::AppInnerIconLoader(
AppServiceProxyBase* host)
: … { … }
std::optional<IconKey> AppServiceProxyBase::AppInnerIconLoader::GetIconKey(
const std::string& id) { … }
std::unique_ptr<IconLoader::Releaser>
AppServiceProxyBase::AppInnerIconLoader::LoadIconFromIconKey(
const std::string& id,
const IconKey& icon_key,
IconType icon_type,
int32_t size_hint_in_dip,
bool allow_placeholder_icon,
apps::LoadIconCallback callback) { … }
AppServiceProxyBase::AppServiceProxyBase(Profile* profile)
: … { … }
AppServiceProxyBase::~AppServiceProxyBase() = default;
void AppServiceProxyBase::ReinitializeForTesting(
Profile* profile,
base::OnceClosure read_completed_for_testing,
base::OnceClosure write_completed_for_testing) { … }
bool AppServiceProxyBase::IsValidProfile() { … }
void AppServiceProxyBase::Initialize() { … }
AppPublisher* AppServiceProxyBase::GetPublisher(AppType app_type) { … }
apps::AppRegistryCache& AppServiceProxyBase::AppRegistryCache() { … }
apps::AppCapabilityAccessCache&
AppServiceProxyBase::AppCapabilityAccessCache() { … }
BrowserAppLauncher* AppServiceProxyBase::BrowserAppLauncher() { … }
apps::PreferredAppsListHandle& AppServiceProxyBase::PreferredAppsList() { … }
void AppServiceProxyBase::RegisterPublisher(AppType app_type,
AppPublisher* publisher) { … }
void AppServiceProxyBase::UnregisterPublisher(AppType app_type) { … }
void AppServiceProxyBase::OnSupportedLinksPreferenceChanged(
const std::string& app_id,
bool open_in_app) { … }
std::unique_ptr<IconLoader::Releaser> AppServiceProxyBase::LoadIcon(
const std::string& app_id,
const IconType& icon_type,
int32_t size_hint_in_dip,
bool allow_placeholder_icon,
apps::LoadIconCallback callback) { … }
uint32_t AppServiceProxyBase::GetIconEffects(const std::string& app_id) { … }
std::unique_ptr<apps::IconLoader::Releaser>
AppServiceProxyBase::LoadIconWithIconEffects(const std::string& app_id,
uint32_t icon_effects,
IconType icon_type,
int32_t size_hint_in_dip,
bool allow_placeholder_icon,
LoadIconCallback callback) { … }
void AppServiceProxyBase::Launch(const std::string& app_id,
int32_t event_flags,
apps::LaunchSource launch_source,
apps::WindowInfoPtr window_info) { … }
void AppServiceProxyBase::LaunchAppWithFiles(
const std::string& app_id,
int32_t event_flags,
LaunchSource launch_source,
std::vector<base::FilePath> file_paths) { … }
void AppServiceProxyBase::LaunchAppWithIntent(const std::string& app_id,
int32_t event_flags,
IntentPtr intent,
LaunchSource launch_source,
WindowInfoPtr window_info,
LaunchCallback callback) { … }
void AppServiceProxyBase::LaunchAppWithUrl(const std::string& app_id,
int32_t event_flags,
GURL url,
LaunchSource launch_source,
WindowInfoPtr window_info,
LaunchCallback callback) { … }
void AppServiceProxyBase::LaunchAppWithParams(AppLaunchParams&& params,
LaunchCallback callback) { … }
void AppServiceProxyBase::SetPermission(const std::string& app_id,
PermissionPtr permission) { … }
void AppServiceProxyBase::UninstallSilently(const std::string& app_id,
UninstallSource uninstall_source) { … }
void AppServiceProxyBase::StopApp(const std::string& app_id) { … }
void AppServiceProxyBase::GetMenuModel(
const std::string& app_id,
MenuType menu_type,
int64_t display_id,
base::OnceCallback<void(MenuItems)> callback) { … }
void AppServiceProxyBase::UpdateAppSize(const std::string& app_id) { … }
void AppServiceProxyBase::ExecuteContextMenuCommand(
const std::string& app_id,
int command_id,
const std::string& shortcut_id,
int64_t display_id) { … }
void AppServiceProxyBase::OpenNativeSettings(const std::string& app_id) { … }
apps::IconLoader* AppServiceProxyBase::OverrideInnerIconLoaderForTesting(
apps::IconLoader* icon_loader) { … }
std::vector<std::string> AppServiceProxyBase::GetAppIdsForUrl(
const GURL& url,
bool exclude_browsers,
bool exclude_browser_tab_apps) { … }
std::vector<IntentLaunchInfo> AppServiceProxyBase::GetAppsForIntent(
const apps::IntentPtr& intent,
bool exclude_browsers,
bool exclude_browser_tab_apps) { … }
bool AppServiceProxyBase::ShouldExcludeBrowserTabApps(
bool exclude_browser_tab_apps,
WindowMode window_mode) { … }
std::vector<IntentLaunchInfo> AppServiceProxyBase::GetAppsForFiles(
std::vector<apps::IntentFilePtr> files) { … }
void AppServiceProxyBase::SetSupportedLinksPreference(
const std::string& app_id) { … }
void AppServiceProxyBase::SetSupportedLinksPreference(
const std::string& app_id,
IntentFilters all_link_filters) { … }
void AppServiceProxyBase::RemoveSupportedLinksPreference(
const std::string& app_id) { … }
void AppServiceProxyBase::SetWindowMode(const std::string& app_id,
WindowMode window_mode) { … }
void AppServiceProxyBase::OnApps(std::vector<AppPtr> deltas,
AppType app_type,
bool should_notify_initialized) { … }
void AppServiceProxyBase::OnCapabilityAccesses(
std::vector<CapabilityAccessPtr> deltas) { … }
IntentFilterPtr AppServiceProxyBase::FindBestMatchingFilter(
const IntentPtr& intent) { … }
void AppServiceProxyBase::PerformPostLaunchTasks(
apps::LaunchSource launch_source) { … }
void AppServiceProxyBase::RecordAppPlatformMetrics(
Profile* profile,
const apps::AppUpdate& update,
apps::LaunchSource launch_source,
apps::LaunchContainer container) { … }
void AppServiceProxyBase::PerformPostUninstallTasks(
apps::AppType app_type,
const std::string& app_id,
UninstallSource uninstall_source) { … }
void AppServiceProxyBase::OnLaunched(LaunchCallback callback,
LaunchResult&& launch_result) { … }
bool AppServiceProxyBase::ShouldReadIcons(AppType app_type) { … }
IntentLaunchInfo AppServiceProxyBase::CreateIntentLaunchInfo(
const apps::IntentPtr& intent,
const apps::IntentFilterPtr& filter,
const apps::AppUpdate& update) { … }
IntentLaunchInfo::IntentLaunchInfo() = default;
IntentLaunchInfo::~IntentLaunchInfo() = default;
IntentLaunchInfo::IntentLaunchInfo(const IntentLaunchInfo& other) = default;
}