blob: df14cbdd0158a220532e44526c6fdff08c5cf99f [file] [log] [blame]
// Copyright 2020 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_APPS_APP_SERVICE_BOREALIS_APPS_H_
#define CHROME_BROWSER_APPS_APP_SERVICE_BOREALIS_APPS_H_
#include <memory>
#include <string>
#include "components/services/app_service/public/cpp/publisher_base.h"
#include "components/services/app_service/public/mojom/app_service.mojom.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/remote_set.h"
class Profile;
namespace apps {
// An app publisher (in the App Service sense) of Borealis apps.
// See components/services/app_service/README.md.
class BorealisApps : public apps::PublisherBase {
public:
BorealisApps(const mojo::Remote<apps::mojom::AppService>& app_service,
Profile* profile);
~BorealisApps() override;
// Disallow copy and assign.
BorealisApps(const BorealisApps&) = delete;
BorealisApps& operator=(const BorealisApps&) = delete;
private:
// apps::PublisherBase overrides.
void Connect(mojo::PendingRemote<apps::mojom::Subscriber> subscriber_remote,
apps::mojom::ConnectOptionsPtr opts) override;
void LoadIcon(const std::string& app_id,
apps::mojom::IconKeyPtr icon_key,
apps::mojom::IconType icon_type,
int32_t size_hint_in_dip,
bool allow_placeholder_icon,
LoadIconCallback callback) override;
void Launch(const std::string& app_id,
int32_t event_flags,
apps::mojom::LaunchSource launch_source,
int64_t display_id) override;
void GetMenuModel(const std::string& app_id,
apps::mojom::MenuType menu_type,
int64_t display_id,
GetMenuModelCallback callback) override;
mojo::RemoteSet<apps::mojom::Subscriber> subscribers_;
Profile* const profile_;
};
} // namespace apps
#endif // CHROME_BROWSER_APPS_APP_SERVICE_BOREALIS_APPS_H_