blob: 694184fc781e81d89dee0573750a022f681a2c35 [file] [log] [blame]
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CONTEXTUAL_TASKS_CONTEXTUAL_TASKS_PAGE_HANDLER_H_
#define CHROME_BROWSER_CONTEXTUAL_TASKS_CONTEXTUAL_TASKS_PAGE_HANDLER_H_
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ref.h"
#include "chrome/browser/contextual_tasks/contextual_tasks.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace base {
class Uuid;
}
namespace content {
class WebUI;
}
class ContextualTasksUI;
namespace contextual_tasks {
class ContextualTasksUiService;
} // namespace contextual_tasks
class ContextualTasksPageHandler : public contextual_tasks::mojom::PageHandler {
public:
ContextualTasksPageHandler(
mojo::PendingRemote<contextual_tasks::mojom::Page> page,
mojo::PendingReceiver<contextual_tasks::mojom::PageHandler> page_handler,
content::WebUI* web_ui,
ContextualTasksUI* web_ui_controller,
contextual_tasks::ContextualTasksUiService* contextual_tasks_ui_service);
ContextualTasksPageHandler(const ContextualTasksPageHandler&) = delete;
ContextualTasksPageHandler& operator=(const ContextualTasksPageHandler&) =
delete;
~ContextualTasksPageHandler() override;
// contextual_tasks::mojom::PageHandler impl:
void GetThreadUrl(GetThreadUrlCallback callback) override;
void GetUrlForTask(const base::Uuid& uuid,
GetUrlForTaskCallback callback) override;
void SetTaskId(const base::Uuid& uuid) override;
void SetThreadTitle(const std::string& title) override;
void ShowUi() override;
private:
mojo::Remote<contextual_tasks::mojom::Page> page_;
mojo::Receiver<contextual_tasks::mojom::PageHandler> page_handler_;
const raw_ref<content::WebUI> web_ui_;
const raw_ref<ContextualTasksUI> web_ui_controller_;
const raw_ptr<contextual_tasks::ContextualTasksUiService> ui_service_;
};
#endif // CHROME_BROWSER_CONTEXTUAL_TASKS_CONTEXTUAL_TASKS_PAGE_HANDLER_H_