Correctly set user agent for devtools
authorCheng Zhao <zcbenz@gmail.com>
Mon, 14 Sep 2015 14:49:22 +0000 (22:49 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 14 Sep 2015 14:55:29 +0000 (22:55 +0800)
atom/app/atom_content_client.cc
atom/app/atom_content_client.h

index 1ba1f20315647d1fb58aa03cc82652625e377342..e760c01453d4f0be3d5fccbbcc36cfc22fe5356a 100644 (file)
@@ -7,6 +7,7 @@
 #include <string>
 #include <vector>
 
+#include "atom/common/atom_version.h"
 #include "atom/common/chrome_version.h"
 #include "atom/common/options_switches.h"
 #include "base/command_line.h"
@@ -14,6 +15,7 @@
 #include "base/strings/string_util.h"
 #include "content/public/common/content_constants.h"
 #include "content/public/common/pepper_plugin_info.h"
+#include "content/public/common/user_agent.h"
 #include "ppapi/shared_impl/ppapi_permissions.h"
 
 namespace atom {
@@ -72,6 +74,12 @@ std::string AtomContentClient::GetProduct() const {
   return "Chrome/" CHROME_VERSION_STRING;
 }
 
+std::string AtomContentClient::GetUserAgent() const {
+  return content::BuildUserAgentFromProduct(
+      "Chrome/" CHROME_VERSION_STRING " "
+      ATOM_PRODUCT_NAME "/" ATOM_VERSION_STRING);
+}
+
 void AtomContentClient::AddAdditionalSchemes(
     std::vector<std::string>* standard_schemes,
     std::vector<std::string>* savable_schemes) {
index 279ec7179f49172aa581b464775f415d49f9bd65..a6b2f73e7faaf055ae201943f2723f0ed128343c 100644 (file)
@@ -20,6 +20,7 @@ class AtomContentClient : public brightray::ContentClient {
  protected:
   // content::ContentClient:
   std::string GetProduct() const override;
+  std::string GetUserAgent() const override;
   void AddAdditionalSchemes(
       std::vector<std::string>* standard_schemes,
       std::vector<std::string>* savable_schemes) override;