Chromium Code Reviews| Index: webkit/glue/user_agent.cc |
| diff --git a/webkit/glue/user_agent.cc b/webkit/glue/user_agent.cc |
| index 516504081f136db4e1551c71f4a3237b020e373e..fb7f7690295682b3f7e7fe72bb490fc16ae21438 100644 |
| --- a/webkit/glue/user_agent.cc |
| +++ b/webkit/glue/user_agent.cc |
| @@ -162,4 +162,32 @@ void SetUserAgentOSInfo(const std::string& os_info) { |
| } |
| #endif |
| +std::string BuildUserAgentOverrideForTabletSiteFromUserAgent( |
| + const std::string& user_agent) { |
| + // |
|
gone
2012/08/03 00:08:26
nit: Remove line
sschmitz
2012/08/03 15:36:58
Done.
|
| + // Example: original user agent text: |
| + // |
| + // Mozilla/5.0 (X11; CrOS x86_64 0.4.0) |
| + // AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1211.0 Safari/537.2 |
| + // |
| + // Copy & Edit to create user agent override text by replacing |
| + // the text within the first pair of "()". In this example: |
| + // |
| + // Mozilla/5.0 (Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53F) |
| + // AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1211.0 Safari/537.2 |
| + // |
|
gone
2012/08/03 00:08:26
Seems relatively fragile, but I don't have a bette
sschmitz
2012/08/03 15:36:58
Yes. I agree. Thanks for looking out.
|
| + size_t p1 = user_agent.find("("); |
| + if (p1 != std::string::npos) { |
| + size_t p2 = user_agent.find(")", p1); |
| + if (p2 != std::string::npos) { |
| + std::string ua_override(user_agent); |
| + ua_override.replace( |
| + p1,p2-p1+1, |
| + "(Linux; U; Android 4.0.2; en-us; Galaxy Nexus Build/ICL53F)"); |
|
gone
2012/08/03 00:08:26
Yank this literal out of the replace() call and ma
sschmitz
2012/08/03 15:36:58
Done.
|
| + return ua_override; |
| + } |
| + } |
| + return std::string(); |
| +} |
| + |
| } // namespace webkit_glue |