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 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
// Copyright 2024 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_BOCA_BOCA_APP_CLIENT_H_
#define CHROMEOS_ASH_COMPONENTS_BOCA_BOCA_APP_CLIENT_H_
#include <map>
#include "base/observer_list.h"
#include "base/observer_list_types.h"
#include "chromeos/ash/components/boca/boca_session_manager.h"
#include "chromeos/ash/components/boca/proto/bundle.pb.h"
#include "chromeos/ash/components/boca/proto/session.pb.h"
#include "components/signin/public/identity_manager/identity_manager.h"
namespace network {
class SharedURLLoaderFactory;
}
namespace ash::boca {
// Defines the interface for sub features to access hub Events
class BocaAppClient : public signin::IdentityManager::Observer {
public:
BocaAppClient(const BocaAppClient&) = delete;
BocaAppClient& operator=(const BocaAppClient&) = delete;
static BocaAppClient* Get();
static bool HasInstance();
// Returns the IdentityManager for the active user profile.
virtual signin::IdentityManager* GetIdentityManager() = 0;
// Returns the URLLoaderFactory associated with user profile.
virtual scoped_refptr<network::SharedURLLoaderFactory>
GetURLLoaderFactory() = 0;
// Launch Boca App.
virtual void LaunchApp();
// Find if there is any open app. Will return not if the app is already
// scheduled to be closed.
virtual bool HasApp();
// Add `BocaSessionManager` instance for the current profile.
virtual void AddSessionManager(BocaSessionManager* session_manager);
// Get `BocaSessionManager` instance for the current profile.
virtual BocaSessionManager* GetSessionManager();
// Get virtual device id. Returns empty is device is not enrolled and has no
// device policy.
virtual std::string GetDeviceId();
virtual std::string GetSchoolToolsServerBaseUrl();
virtual void OpenFeedbackDialog();
// IdentityManager overrides.
void OnIdentityManagerShutdown(
signin::IdentityManager* identity_manager) override;
protected:
BocaAppClient();
~BocaAppClient() override;
private:
std::map<signin::IdentityManager*, BocaSessionManager*> session_manager_map_;
};
} // namespace ash::boca
#endif // CHROMEOS_ASH_COMPONENTS_BOCA_BOCA_APP_CLIENT_H_
|