1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_ASH_COMPONENTS_LANGUAGE_PACKS_LANGUAGE_PACKS_IMPL_H_
#define CHROMEOS_ASH_COMPONENTS_LANGUAGE_PACKS_LANGUAGE_PACKS_IMPL_H_
#include <string>
#include "chromeos/ash/components/language_packs/language_pack_manager.h"
#include "chromeos/ash/components/language_packs/public/mojom/language_packs.mojom.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote_set.h"
namespace ash::language_packs {
class LanguagePacksImpl : public ash::language::mojom::LanguagePacks,
public LanguagePackManager::Observer {
public:
// Singleton getter
static LanguagePacksImpl& GetInstance();
LanguagePacksImpl();
LanguagePacksImpl(const LanguagePacksImpl&) = delete;
LanguagePacksImpl& operator=(const LanguagePacksImpl&) = delete;
// Called when mojom connection is destroyed.
~LanguagePacksImpl() override;
void BindReceiver(
mojo::PendingReceiver<ash::language::mojom::LanguagePacks> receiver);
// LanguagePackManager::Observer:
void OnPackStateChanged(const PackResult& pack_result) override;
// mojom::LanguagePacks interface methods.
void GetPackInfo(ash::language::mojom::FeatureId feature_id,
const std::string& language,
GetPackInfoCallback callback) override;
void InstallPack(ash::language::mojom::FeatureId feature_id,
const std::string& language,
InstallPackCallback callback) override;
void InstallBasePack(ash::language::mojom::FeatureId feature_id,
InstallBasePackCallback callback) override;
void UninstallPack(ash::language::mojom::FeatureId feature_id,
const std::string& language,
UninstallPackCallback callbck) override;
void AddObserver(
mojo::PendingAssociatedRemote<ash::language::mojom::LanguagePacksObserver>
observer) override;
private:
mojo::ReceiverSet<ash::language::mojom::LanguagePacks> receivers_;
mojo::AssociatedRemoteSet<ash::language::mojom::LanguagePacksObserver>
observers_;
};
} // namespace ash::language_packs
#endif // CHROMEOS_ASH_COMPONENTS_LANGUAGE_PACKS_LANGUAGE_PACKS_IMPL_H_
|