]> khamidou — GitHub mirrors - electron.git/commitdiff
Make our user agent string follow standard.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 12 Sep 2014 15:08:13 +0000 (23:08 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 12 Sep 2014 15:08:13 +0000 (23:08 +0800)
atom/browser/native_window.cc

index be41bf25e17773506d1fe624d9e8ffdd8c3efdff..ba2444fc0889baff42a49d39ddc1673bdac7738e 100644 (file)
@@ -67,6 +67,14 @@ const char* kWebRuntimeFeatures[] = {
   switches::kSharedWorker,
 };
 
+std::string RemoveWhitespace(const std::string& str) {
+  std::string trimmed;
+  if (base::RemoveChars(str, " ", &trimmed))
+    return trimmed;
+  else
+    return str;
+}
+
 }  // namespace
 
 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.
   Browser* browser = Browser::Get();
   std::string product_name = base::StringPrintf(
-      "%s/%s Chrome/%s Atom-Shell/" ATOM_VERSION_STRING,
-      browser->GetName().c_str(),
+      "%s/%s Chrome/%s AtomShell/" ATOM_VERSION_STRING,
+      RemoveWhitespace(browser->GetName()).c_str(),
       browser->GetVersion().c_str(),
       CHROME_VERSION_STRING);
   web_contents->GetMutableRendererPrefs()->user_agent_override =