chromium/chrome/browser/ui/views/data_sharing/data_sharing_utils.h

// 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 CHROME_BROWSER_UI_VIEWS_DATA_SHARING_DATA_SHARING_UTILS_H_
#define CHROME_BROWSER_UI_VIEWS_DATA_SHARING_DATA_SHARING_UTILS_H_

#include "base/uuid.h"
#include "chrome/browser/profiles/profile.h"
#include "components/data_sharing/public/group_data.h"
#include "components/saved_tab_groups/types.h"

namespace data_sharing {

// The query params of the urls to internally load webui.
inline std::string_view kQueryParamFlow =;
inline std::string_view kQueryParamGroupId =;
inline std::string_view kQueryParamTokenSecret =;
inline std::string_view kQueryParamTabGroupId =;

// Possible values of kQueryParamFlow in url.
inline std::string_view kFlowShare =;
inline std::string_view kFlowJoin =;
inline std::string_view kFlowManage =;

// `request_info` contains the info we want to pass into the loaded WebUI.
std::optional<GURL> GenerateWebUIUrl(
    std::variant<tab_groups::LocalTabGroupID, data_sharing::GroupToken>
        request_info,
    Profile* profile);

// Associate tab group with `group_id` returned by the Share flow WebUI, i.e.
// make the tab group shared.
void AssociateTabGroupWithGroupId(const std::string& tab_group_id,
                                  const std::string& group_id,
                                  Profile* profile);

// Get share link from data sharing service.
GURL GetShareLink(const std::string& group_id,
                  const std::string& access_token,
                  Profile* profile);

}  // namespace data_sharing

#endif  // CHROME_BROWSER_UI_VIEWS_DATA_SHARING_DATA_SHARING_UTILS_H_