Make our user agent string follow standard.
This commit is contained in:
parent
4a4814b41c
commit
b8a6658ba9
1 changed files with 10 additions and 2 deletions
|
@ -67,6 +67,14 @@ const char* kWebRuntimeFeatures[] = {
|
||||||
switches::kSharedWorker,
|
switches::kSharedWorker,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string RemoveWhitespace(const std::string& str) {
|
||||||
|
std::string trimmed;
|
||||||
|
if (base::RemoveChars(str, " ", &trimmed))
|
||||||
|
return trimmed;
|
||||||
|
else
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
NativeWindow::NativeWindow(content::WebContents* web_contents,
|
NativeWindow::NativeWindow(content::WebContents* web_contents,
|
||||||
|
@ -106,8 +114,8 @@ NativeWindow::NativeWindow(content::WebContents* web_contents,
|
||||||
// Override the user agent to contain application and atom-shell's version.
|
// Override the user agent to contain application and atom-shell's version.
|
||||||
Browser* browser = Browser::Get();
|
Browser* browser = Browser::Get();
|
||||||
std::string product_name = base::StringPrintf(
|
std::string product_name = base::StringPrintf(
|
||||||
"%s/%s Chrome/%s Atom-Shell/" ATOM_VERSION_STRING,
|
"%s/%s Chrome/%s AtomShell/" ATOM_VERSION_STRING,
|
||||||
browser->GetName().c_str(),
|
RemoveWhitespace(browser->GetName()).c_str(),
|
||||||
browser->GetVersion().c_str(),
|
browser->GetVersion().c_str(),
|
||||||
CHROME_VERSION_STRING);
|
CHROME_VERSION_STRING);
|
||||||
web_contents->GetMutableRendererPrefs()->user_agent_override =
|
web_contents->GetMutableRendererPrefs()->user_agent_override =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue