Move the iOS user agent functions to ios/web/public.
The old implementations lived in //content, but they had no content dependencies, so they are safe to move to //web. BUG=390969 TEST=None Review URL: https://codereview.chromium.org/364853010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281824 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
content
ios
@ -472,7 +472,6 @@
|
||||
'common/url_schemes.cc',
|
||||
'common/url_schemes.h',
|
||||
'common/user_agent.cc',
|
||||
'common/user_agent_ios.mm',
|
||||
'common/utility_messages.h',
|
||||
'common/view_message_enums.h',
|
||||
'common/view_messages.h',
|
||||
|
@ -11,8 +11,9 @@
|
||||
'type': 'none',
|
||||
'dependencies': [
|
||||
'ios_base.gyp:*',
|
||||
'ios_web.gyp:*',
|
||||
'ios_tests_unit.gyp:*',
|
||||
'provider/ios_provider_web.gyp:*',
|
||||
'web/ios_web.gyp:*',
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright 2013 The Chromium Authors. All rights reserved.
|
||||
# Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
{
|
||||
@ -10,14 +10,14 @@
|
||||
'target_name': 'ios_provider_web',
|
||||
'type': 'none',
|
||||
'include_dirs': [
|
||||
'..',
|
||||
'../..',
|
||||
],
|
||||
'sources': [
|
||||
'public/provider/web/web_state.h',
|
||||
'public/provider/web/web_state_user_data.h',
|
||||
'../public/provider/web/web_state.h',
|
||||
'../public/provider/web/web_state_user_data.h',
|
||||
],
|
||||
'dependencies': [
|
||||
'ios_base.gyp:ios_consumer_base',
|
||||
'../ios_base.gyp:ios_consumer_base',
|
||||
],
|
||||
},
|
||||
],
|
25
ios/web/ios_web.gyp
Normal file
25
ios/web/ios_web.gyp
Normal file
@ -0,0 +1,25 @@
|
||||
# Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
{
|
||||
'variables': {
|
||||
'chromium_code': 1,
|
||||
},
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'ios_web',
|
||||
'type': 'static_library',
|
||||
'include_dirs': [
|
||||
'../..',
|
||||
],
|
||||
'dependencies': [
|
||||
'../../base/base.gyp:base',
|
||||
],
|
||||
'sources': [
|
||||
'public/user_agent.h',
|
||||
'public/user_agent.mm',
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
19
ios/web/public/user_agent.h
Normal file
19
ios/web/public/user_agent.h
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef IOS_WEB_PUBLIC_USER_AGENT_H_
|
||||
#define IOS_WEB_PUBLIC_USER_AGENT_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace web {
|
||||
|
||||
// Returns the user agent to use for the given product name.
|
||||
// The returned user agent is very similar to that used by Mobile Safari, for
|
||||
// web page compatibility.
|
||||
std::string BuildUserAgentFromProduct(const std::string& product);
|
||||
|
||||
} // namespace web
|
||||
|
||||
#endif // IOS_WEB_PUBLIC_USER_AGENT_H_
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "ios/web/public/user_agent.h"
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@ -58,10 +58,6 @@ const UAVersions& GetUAVersionsForCurrentOS() {
|
||||
return version_map[arraysize(version_map) - 1].ua_versions;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace content {
|
||||
|
||||
std::string BuildOSCpuInfo() {
|
||||
int32 os_major_version = 0;
|
||||
int32 os_minor_version = 0;
|
||||
@ -102,6 +98,10 @@ std::string BuildOSCpuInfo() {
|
||||
return os_cpu;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace web {
|
||||
|
||||
std::string BuildUserAgentFromProduct(const std::string& product) {
|
||||
// Retrieve the kernel build number.
|
||||
int mib[2] = {CTL_KERN, KERN_OSVERSION};
|
||||
@ -127,4 +127,4 @@ std::string BuildUserAgentFromProduct(const std::string& product) {
|
||||
return user_agent;
|
||||
}
|
||||
|
||||
} // namespace content
|
||||
} // namespace web
|
Reference in New Issue
Block a user