Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cobalt client hints playground. #5057

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions content/browser/client_hints/client_hints.cc
Original file line number Diff line number Diff line change
@@ -956,6 +956,15 @@ void AddRequestClientHintsHeaders(

GURL url = origin.GetURL();

// Add Cobalt Client Hint headers
// This code does not work, it is not called.
#if BUILDFLAG(IS_COBALT)
const base::StringPiece header_string =
"Sec-CH-UA-Co-Android-OS-Experience: Amati\r\n"
"Sec-CH-UA-Co-Android-Play-Services-Version: 31\r\n";
headers->AddHeadersFromString(header_string);
#endif

// Add Headers
if (ShouldAddClientHint(data, WebClientHintsType::kDeviceMemory_DEPRECATED)) {
AddDeviceMemoryHeader(headers, /*use_deprecated_version*/ true);
Original file line number Diff line number Diff line change
@@ -507,6 +507,12 @@ void BaseFetchContext::AddClientHintsIfNecessary(
.c_str(),
prefers_reduced_motion.value());
}

#if BUILDFLAG(IS_COBALT)
// This code is called, and it works.
LOG(INFO) << "ColinL: Adding Cobalt Client Hint headers.";
request.SetHttpHeaderField("Sec-CH-UA-Co-Android-OS-Experience", "Amati");
#endif
}

void BaseFetchContext::PrintAccessDeniedMessage(const KURL& url) const {