#include "components/lens/lens_url_utils.h"
#include <map>
#include <string>
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "components/lens/lens_entrypoints.h"
#include "components/lens/lens_features.h"
#include "components/lens/lens_metadata.h"
#include "components/lens/lens_metadata.mojom.h"
#include "components/lens/lens_rendering_environment.h"
#include "net/base/url_util.h"
#include "url/gurl.h"
namespace {
constexpr char kEntryPointQueryParameter[] = …;
constexpr char kChromeRegionSearchMenuItem[] = …;
constexpr char kChromeSearchWithGoogleLensContextMenuItem[] = …;
constexpr char kChromeTranslateImageWithGoogleLensContextMenuItem[] = …;
constexpr char kChromeOpenNewTabSidePanel[] = …;
constexpr char kChromeFullscreenSearchMenuItem[] = …;
constexpr char kChromeVideoFrameSearchContextMenuItem[] = …;
constexpr char kCompanionRegionSearch[] = …;
constexpr char kSurfaceQueryParameter[] = …;
constexpr char kChromiumSurfaceProtoValue[] = …;
constexpr char kStartTimeQueryParameter[] = …;
constexpr char kLensMetadataParameter[] = …;
constexpr char kRenderingEnvironmentQueryParameter[] = …;
constexpr char kOneLensDesktopWebChromeSidePanel[] = …;
constexpr char kOneLensDesktopWebFullscreen[] = …;
constexpr char kOneLensAmbientVisualSearchWebFullscreen[] = …;
constexpr char kChromeSearchCompanion[] = …;
constexpr char kViewportWidthQueryParameter[] = …;
constexpr char kViewportHeightQueryParameter[] = …;
constexpr char kSourceQueryParameter[] = …;
constexpr char kSourceQueryParameterValue[] = …;
void AppendQueryParam(std::string* query_string,
const char name[],
const char value[]) { … }
std::string GetEntryPointQueryString(lens::EntryPoint entry_point) { … }
std::map<std::string, std::string> GetLensQueryParametersMap(
lens::EntryPoint ep,
lens::RenderingEnvironment re,
bool is_side_panel_request) { … }
lens::RenderingEnvironment GetRenderingEnvironment(
bool is_lens_side_panel_request,
bool is_full_screen_request,
bool is_companion_request) { … }
}
namespace lens {
void AppendLogsQueryParam(
std::string* query_string,
const std::vector<lens::mojom::LatencyLogPtr>& log_data) { … }
GURL AppendOrReplaceQueryParametersForLensRequest(const GURL& url,
lens::EntryPoint ep,
lens::RenderingEnvironment re,
bool is_side_panel_request) { … }
GURL AppendOrReplaceStartTimeIfLensRequest(const GURL& url) { … }
GURL AppendOrReplaceViewportSizeForRequest(const GURL& url,
const gfx::Size& viewport_size) { … }
std::string GetQueryParametersForLensRequest(lens::EntryPoint ep,
bool is_lens_side_panel_request,
bool is_full_screen_request,
bool is_companion_request) { … }
bool IsValidLensResultUrl(const GURL& url) { … }
bool IsLensUrl(const GURL& url) { … }
}