#include "chrome/browser/extensions/api/side_panel/side_panel_service.h"
#include <cstddef>
#include <memory>
#include <optional>
#include "base/no_destructor.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/extensions/extension_side_panel_utils.h"
#include "chrome/common/extensions/api/side_panel.h"
#include "chrome/common/extensions/api/side_panel/side_panel_info.h"
#include "components/sessions/core/session_id.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/pref_types.h"
#include "extensions/common/extension_features.h"
namespace extensions {
namespace {
constexpr PrefMap kOpenSidePanelOnIconClickPref = …;
api::side_panel::PanelOptions GetPanelOptionsFromManifest(
const Extension& extension) { … }
}
SidePanelService::~SidePanelService() = default;
SidePanelService::SidePanelService(content::BrowserContext* context)
: … { … }
bool SidePanelService::HasSidePanelActionForTab(const Extension& extension,
TabId tab_id) { … }
bool SidePanelService::HasSidePanelContextMenuActionForTab(
const Extension& extension,
TabId tab_id) { … }
bool SidePanelService::HasSidePanelAvailableForTab(const Extension& extension,
TabId tab_id) { … }
api::side_panel::PanelOptions SidePanelService::GetOptions(
const Extension& extension,
std::optional<TabId> id) { … }
api::side_panel::PanelOptions SidePanelService::GetSpecificOptionsForTab(
const Extension& extension,
TabId tab_id) { … }
void SidePanelService::SetOptions(const Extension& extension,
api::side_panel::PanelOptions options) { … }
bool SidePanelService::HasExtensionPanelOptionsForTest(const ExtensionId& id) { … }
BrowserContextKeyedAPIFactory<SidePanelService>*
SidePanelService::GetFactoryInstance() { … }
SidePanelService* SidePanelService::Get(content::BrowserContext* context) { … }
void SidePanelService::RemoveExtensionOptions(const ExtensionId& id) { … }
bool SidePanelService::OpenSidePanelOnIconClick(
const ExtensionId& extension_id) { … }
void SidePanelService::SetOpenSidePanelOnIconClick(
const ExtensionId& extension_id,
bool open_side_panel_on_icon_click) { … }
base::expected<bool, std::string> SidePanelService::OpenSidePanelForWindow(
const Extension& extension,
content::BrowserContext* context,
int window_id,
bool include_incognito_information) { … }
base::expected<bool, std::string> SidePanelService::OpenSidePanelForTab(
const Extension& extension,
content::BrowserContext* context,
int tab_id,
std::optional<int> window_id,
bool include_incognito_information) { … }
void SidePanelService::AddObserver(Observer* observer) { … }
void SidePanelService::RemoveObserver(Observer* observer) { … }
void SidePanelService::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionReason reason) { … }
void SidePanelService::OnExtensionUninstalled(
content::BrowserContext* browser_context,
const Extension* extension,
UninstallReason reason) { … }
void SidePanelService::Shutdown() { … }
}