Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: ios/web/public/user_agent.mm

Issue 839733004: Style fixes in //ios (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ios/web/public/user_agent.h" 5 #include "ios/web/public/user_agent.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include <sys/sysctl.h> 9 #include <sys/sysctl.h>
10 #include <string> 10 #include <string>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 } // namespace 102 } // namespace
103 103
104 namespace web { 104 namespace web {
105 105
106 std::string BuildUserAgentFromProduct(const std::string& product) { 106 std::string BuildUserAgentFromProduct(const std::string& product) {
107 // Retrieve the kernel build number. 107 // Retrieve the kernel build number.
108 int mib[2] = {CTL_KERN, KERN_OSVERSION}; 108 int mib[2] = {CTL_KERN, KERN_OSVERSION};
109 unsigned int namelen = sizeof(mib) / sizeof(mib[0]); 109 unsigned int namelen = sizeof(mib) / sizeof(mib[0]);
110 size_t bufferSize = 0; 110 size_t bufferSize = 0;
111 sysctl(mib, namelen, NULL, &bufferSize, NULL, 0); 111 sysctl(mib, namelen, nullptr, &bufferSize, nullptr, 0);
112 char kernel_version[bufferSize]; 112 char kernel_version[bufferSize];
113 int result = sysctl(mib, namelen, kernel_version, &bufferSize, NULL, 0); 113 int result = sysctl(mib, namelen, kernel_version, &bufferSize, nullptr, 0);
114 DCHECK(result == 0); 114 DCHECK(result == 0);
115 115
116 UAVersions ua_versions = GetUAVersionsForCurrentOS(); 116 UAVersions ua_versions = GetUAVersionsForCurrentOS();
117 117
118 std::string user_agent; 118 std::string user_agent;
119 base::StringAppendF(&user_agent, 119 base::StringAppendF(&user_agent,
120 "Mozilla/5.0 (%s) AppleWebKit/%s" 120 "Mozilla/5.0 (%s) AppleWebKit/%s"
121 " (KHTML, like Gecko) %s Mobile/%s Safari/%s", 121 " (KHTML, like Gecko) %s Mobile/%s Safari/%s",
122 BuildOSCpuInfo().c_str(), 122 BuildOSCpuInfo().c_str(),
123 ua_versions.webkit_version_string, 123 ua_versions.webkit_version_string,
124 product.c_str(), 124 product.c_str(),
125 kernel_version, 125 kernel_version,
126 ua_versions.safari_version_string); 126 ua_versions.safari_version_string);
127 127
128 return user_agent; 128 return user_agent;
129 } 129 }
130 130
131 } // namespace web 131 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698