chromium/chrome/browser/companion/core/companion_url_builder.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/companion/core/companion_url_builder.h"

#include "base/base64url.h"
#include "base/feature_list.h"
#include "base/time/time.h"
#include "chrome/browser/companion/core/companion_permission_utils.h"
#include "chrome/browser/companion/core/constants.h"
#include "chrome/browser/companion/core/features.h"
#include "chrome/browser/companion/core/proto/companion_url_params.pb.h"
#include "chrome/browser/companion/core/signin_delegate.h"
#include "chrome/browser/companion/core/utils.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "net/base/url_util.h"
#include "url/gurl.h"

// Need to BUILDFLAG these lines because kSidePanelCompanionEntryPinnedToToolbar
// does not exist on Android and will break try-bots
#if (!BUILDFLAG(IS_ANDROID))
#include "chrome/common/companion/visual_query/features.h"
#endif

namespace companion {
namespace {

// URL query string param name that contains the request params for companion
// page in protobuf format.
inline constexpr char kCompanionRequestQueryParameterKey[] =;

// Query parameter for the url of the main web content.
inline constexpr char kUrlQueryParameterKey[] =;
// Query parameter for the Chrome WebUI origin.
inline constexpr char kOriginQueryParameterKey[] =;
// Query parameter for the search text query.
inline constexpr char kTextQueryParameterKey[] =;
// Query parameter value for the Chrome WebUI origin. This needs to be different
// from the WebUI URL constant because it does not include the last '/'.
inline constexpr char kOriginQueryParameterValue[] =;

}  // namespace

CompanionUrlBuilder::CompanionUrlBuilder(PrefService* pref_service,
                                         SigninDelegate* signin_delegate)
    :{}

CompanionUrlBuilder::~CompanionUrlBuilder() = default;

GURL CompanionUrlBuilder::BuildCompanionURL(const GURL& page_url) {}

GURL CompanionUrlBuilder::BuildCompanionURL(
    const GURL& page_url,
    const std::string& text_query,
    std::unique_ptr<base::Time> text_query_start_time) {}

GURL CompanionUrlBuilder::AppendCompanionParamsToURL(
    const GURL& base_url,
    const GURL& page_url,
    const std::string& text_query,
    std::unique_ptr<base::Time> text_query_start_time) {}

std::string CompanionUrlBuilder::BuildCompanionUrlParamProto(
    const GURL& page_url,
    std::unique_ptr<base::Time> text_query_start_time) {}

}  // namespace companion