Skip to content

Commit

Permalink
Move user_agent code from webkit/ to content/.
Browse files Browse the repository at this point in the history
BUG=265753, 338338, 237249
TEST=content_unittests
R=jam@chromium.org
TBR=darin

Review URL: https://codereview.chromium.org/186883002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256174 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
tfarina@chromium.org committed Mar 11, 2014
1 parent 3f656b6 commit efd2c3f
Show file tree
Hide file tree
Showing 39 changed files with 173 additions and 247 deletions.
4 changes: 2 additions & 2 deletions android_webview/common/aw_content_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#include "base/basictypes.h"
#include "base/command_line.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/user_agent.h"
#include "ipc/ipc_message.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "webkit/common/user_agent/user_agent_util.h"

namespace {

Expand All @@ -32,7 +32,7 @@ std::string GetUserAgent() {
switches::kUseMobileUserAgent)) {
product += " Mobile";
}
return webkit_glue::BuildUserAgentFromProduct(product);
return content::BuildUserAgentFromProduct(product);
}

std::string AwContentClient::GetProduct() const {
Expand Down
5 changes: 2 additions & 3 deletions android_webview/native/aw_dev_tools_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#include "content/public/browser/devtools_http_handler_delegate.h"
#include "content/public/browser/devtools_target.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/user_agent.h"
#include "jni/AwDevToolsServer_jni.h"
#include "net/socket/unix_domain_socket_posix.h"
#include "webkit/common/user_agent/user_agent_util.h"

using content::DevToolsAgentHost;
using content::RenderViewHost;
Expand Down Expand Up @@ -178,8 +178,7 @@ void AwDevToolsServer::Start() {
base::StringPrintf(kSocketNameFormat, getpid()),
"",
base::Bind(&content::CanUserConnectToDevTools)),
base::StringPrintf(kFrontEndURL,
webkit_glue::GetWebKitRevision().c_str()),
base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()),
new AwDevToolsServerDelegate());
}

Expand Down
4 changes: 2 additions & 2 deletions android_webview/native/webview_native.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
'dependencies': [
'../../base/base.gyp:base_static',
'../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../../cc/cc.gyp:cc',
'../../components/components.gyp:autofill_content_browser',
'../../components/components.gyp:web_contents_delegate_android',
'../../cc/cc.gyp:cc',
'../../content/content.gyp:content_common',
'../../net/net.gyp:net',
'../../skia/skia.gyp:skia',
'../../ui/gfx/gfx.gyp:gfx',
'../../ui/gfx/gfx.gyp:gfx_geometry',
'../../ui/ui.gyp:ui',
'../../webkit/common/user_agent/webkit_user_agent.gyp:user_agent',
'../../webkit/common/webkit_common.gyp:webkit_common',
'../../webkit/storage_browser.gyp:webkit_storage_browser',
'../../webkit/storage_common.gyp:webkit_storage_common',
Expand Down
4 changes: 2 additions & 2 deletions apps/shell/common/shell_content_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

#include "base/strings/string_piece.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/common/user_agent.h"
#include "extensions/common/constants.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "webkit/common/user_agent/user_agent_util.h"

namespace apps {

Expand All @@ -29,7 +29,7 @@ void ShellContentClient::AddAdditionalSchemes(
std::string ShellContentClient::GetUserAgent() const {
// TODO(derat): Figure out what this should be for app_shell and determine
// whether we need to include a version number to placate browser sniffing.
return webkit_glue::BuildUserAgentFromProduct("Chrome");
return content::BuildUserAgentFromProduct("Chrome");
}

base::string16 ShellContentClient::GetLocalizedString(int message_id) const {
Expand Down
5 changes: 2 additions & 3 deletions chrome/browser/android/dev_tools_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/user_agent.h"
#include "grit/browser_resources.h"
#include "jni/DevToolsServer_jni.h"
#include "net/socket/unix_domain_socket_posix.h"
#include "net/url_request/url_request_context_getter.h"
#include "ui/base/resource/resource_bundle.h"
#include "webkit/common/user_agent/user_agent_util.h"

using content::DevToolsAgentHost;
using content::RenderViewHost;
Expand Down Expand Up @@ -414,8 +414,7 @@ void DevToolsServer::Start() {
socket_name_,
base::StringPrintf("%s_%d", socket_name_.c_str(), getpid()),
base::Bind(&content::CanUserConnectToDevTools)),
base::StringPrintf(kFrontEndURL,
webkit_glue::GetWebKitRevision().c_str()),
base::StringPrintf(kFrontEndURL, content::GetWebKitRevision().c_str()),
new DevToolsServerDelegate());
}

Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/chromeos/drive/drive_integration_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
#include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/user_agent.h"
#include "google_apis/drive/auth_service.h"
#include "google_apis/drive/gdata_wapi_url_generator.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "webkit/browser/fileapi/external_mount_points.h"
#include "webkit/common/user_agent/user_agent_util.h"

using content::BrowserContext;
using content::BrowserThread;
Expand Down Expand Up @@ -82,7 +82,7 @@ std::string GetDriveUserAgent() {
// This part is <client_name>/<version>.
const char kLibraryInfo[] = "chrome-cc/none";

const std::string os_cpu_info = webkit_glue::BuildOSCpuInfo();
const std::string os_cpu_info = content::BuildOSCpuInfo();

// Add "gzip" to receive compressed data from the server.
// (see https://developers.google.com/drive/performance)
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/feedback/feedback_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include "chrome/common/metrics/metrics_log_manager.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_client.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
Expand Down
7 changes: 3 additions & 4 deletions chrome/browser/ui/browser_commands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@
#include "content/public/common/renderer_preferences.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/url_utils.h"
#include "content/public/common/user_agent.h"
#include "extensions/browser/extension_system.h"
#include "net/base/escape.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "webkit/common/user_agent/user_agent_util.h"

#if defined(OS_WIN)
#include "chrome/browser/ui/metro_pin_tab_helper_win.h"
Expand Down Expand Up @@ -1098,9 +1098,8 @@ void ToggleRequestTabletSite(Browser* browser) {
std::string product;
if (version_info.is_valid())
product = version_info.ProductNameAndVersionForUserAgent();
current_tab->SetUserAgentOverride(
webkit_glue::BuildUserAgentFromOSAndProduct(
kOsOverrideForTabletSite, product));
current_tab->SetUserAgentOverride(content::BuildUserAgentFromOSAndProduct(
kOsOverrideForTabletSite, product));
}
controller.ReloadOriginalRequestURL(true);
}
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/webui/help/help_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/common/user_agent.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/google_chrome_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "v8/include/v8.h"
#include "webkit/common/user_agent/user_agent_util.h"

#if defined(OS_MACOSX)
#include "chrome/browser/mac/obsolete_system.h"
Expand Down Expand Up @@ -275,7 +275,7 @@ void HelpHandler::GetLocalizedValues(content::WebUIDataSource* source) {
IDS_ABOUT_TERMS_OF_SERVICE, base::UTF8ToUTF16(chrome::kChromeUITermsURL));
source->AddString("productTOS", tos);

source->AddString("webkitVersion", webkit_glue::GetWebKitVersion());
source->AddString("webkitVersion", content::GetWebKitVersion());

source->AddString("jsEngine", "V8");
source->AddString("jsEngineVersion", v8::V8::GetVersion());
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/webui/version_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/common/user_agent.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/google_chrome_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "v8/include/v8.h"
#include "webkit/common/user_agent/user_agent_util.h"

#if defined(ENABLE_THEMES)
#include "chrome/browser/ui/webui/theme_source.h"
Expand Down Expand Up @@ -51,7 +51,7 @@ content::WebUIDataSource* CreateVersionUIDataSource(Profile* profile) {
html_source->AddLocalizedString("os_name", IDS_ABOUT_VERSION_OS);
html_source->AddLocalizedString("platform", IDS_PLATFORM_LABEL);
html_source->AddString("os_type", version_info.OSType());
html_source->AddString("blink_version", webkit_glue::GetWebKitVersion());
html_source->AddString("blink_version", content::GetWebKitVersion());
html_source->AddString("js_engine", "V8");
html_source->AddString("js_version", v8::V8::GetVersion());

Expand Down
1 change: 0 additions & 1 deletion chrome/chrome_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
'../ui/resources/ui_resources.gyp:ui_resources',
'../ui/shell_dialogs/shell_dialogs.gyp:shell_dialogs',
'../ui/ui.gyp:ui',
'../webkit/common/user_agent/webkit_user_agent.gyp:user_agent',
],
'include_dirs': [
'..',
Expand Down
1 change: 0 additions & 1 deletion chrome/chrome_browser_chromeos.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
'../ui/web_dialogs/web_dialogs.gyp:web_dialogs',
'../url/url.gyp:url_lib',
'../v8/tools/gyp/v8.gyp:v8',
'../webkit/common/user_agent/webkit_user_agent.gyp:user_agent',
'../webkit/storage_browser.gyp:webkit_storage_browser',
'../webkit/storage_common.gyp:webkit_storage_common',
'../webkit/webkit_resources.gyp:webkit_resources',
Expand Down
2 changes: 1 addition & 1 deletion chrome/chrome_browser_extensions.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'../components/components.gyp:url_matcher',
'../components/components.gyp:wifi_component',
'../content/content.gyp:content_browser',
'../content/content.gyp:content_common',
'../crypto/crypto.gyp:crypto',
'../device/bluetooth/bluetooth.gyp:device_bluetooth',
'../device/hid/hid.gyp:device_hid',
Expand All @@ -54,7 +55,6 @@
'../ui/resources/ui_resources.gyp:ui_resources',
'../ui/ui.gyp:ui',
'../url/url.gyp:url_lib',
'../webkit/common/user_agent/webkit_user_agent.gyp:user_agent',
'../webkit/storage_browser.gyp:webkit_storage_browser',
'../webkit/storage_common.gyp:webkit_storage_common',
'../webkit/webkit_resources.gyp:webkit_resources',
Expand Down
1 change: 0 additions & 1 deletion chrome/chrome_browser_ui.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
'../ui/resources/ui_resources.gyp:ui_resources',
'../ui/snapshot/snapshot.gyp:snapshot',
'../ui/ui.gyp:ui',
'../webkit/common/user_agent/webkit_user_agent.gyp:user_agent',
],
'include_dirs': [
'..',
Expand Down
1 change: 0 additions & 1 deletion chrome/chrome_common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
'<(DEPTH)/third_party/zlib/google/zip.gyp:zip',
'<(DEPTH)/ui/resources/ui_resources.gyp:ui_resources',
'<(DEPTH)/url/url.gyp:url_lib',
'<(DEPTH)/webkit/common/user_agent/webkit_user_agent.gyp:user_agent',
],
'sources': [
'../apps/app_shim/app_shim_launch.h',
Expand Down
4 changes: 2 additions & 2 deletions chrome/common/chrome_content_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/pepper_plugin_info.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/user_agent.h"
#include "extensions/common/constants.h"
#include "gpu/config/gpu_info.h"
#include "grit/common_resources.h"
#include "ppapi/shared_impl/ppapi_permissions.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
#include "webkit/common/user_agent/user_agent_util.h"

#include "flapper_version.h" // In SHARED_INTERMEDIATE_DIR.
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
Expand Down Expand Up @@ -435,7 +435,7 @@ std::string GetUserAgent() {
if (command_line->HasSwitch(switches::kUseMobileUserAgent))
product += " Mobile";
#endif
return webkit_glue::BuildUserAgentFromProduct(product);
return content::BuildUserAgentFromProduct(product);
}

void ChromeContentClient::SetActiveURL(const GURL& url) {
Expand Down
4 changes: 2 additions & 2 deletions chrome/common/chrome_content_client_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#include "base/strings/string_piece.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/url_constants.h"
#include "content/public/common/user_agent.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "url/gurl.h"
#include "webkit/common/user_agent/user_agent_util.h"

// TODO(ios): Investigate merging with chrome_content_client.cc; this would
// requiring either a lot of ifdefing, or spliting the file into parts.
Expand Down Expand Up @@ -50,7 +50,7 @@

std::string ChromeContentClient::GetUserAgent() const {
std::string product = GetProduct();
return webkit_glue::BuildUserAgentFromProduct(product);
return content::BuildUserAgentFromProduct(product);
}

base::string16 ChromeContentClient::GetLocalizedString(int message_id) const {
Expand Down
1 change: 0 additions & 1 deletion components/autofill/content/browser/risk/fingerprint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/common/content_client.h"
#include "content/public/common/geoposition.h"
#include "content/public/common/webplugininfo.h"
#include "gpu/config/gpu_info.h"
Expand Down
4 changes: 2 additions & 2 deletions content/browser/android/content_view_core_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/menu_item.h"
#include "content/public/common/page_transition_types.h"
#include "content/public/common/user_agent.h"
#include "jni/ContentViewCore_jni.h"
#include "third_party/WebKit/public/web/WebBindings.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
Expand All @@ -61,7 +62,6 @@
#include "ui/gfx/screen.h"
#include "ui/gfx/size_conversions.h"
#include "ui/gfx/size_f.h"
#include "webkit/common/user_agent/user_agent_util.h"

using base::android::AttachCurrentThread;
using base::android::ConvertJavaStringToUTF16;
Expand Down Expand Up @@ -250,7 +250,7 @@ ContentViewCoreImpl::ContentViewCoreImpl(JNIEnv* env,
const char kLinuxInfoStr[] = "X11; Linux x86_64";
std::string product = content::GetContentClient()->GetProduct();
std::string spoofed_ua =
webkit_glue::BuildUserAgentFromOSAndProduct(kLinuxInfoStr, product);
BuildUserAgentFromOSAndProduct(kLinuxInfoStr, product);
web_contents->SetUserAgentOverride(spoofed_ua);

InitWebContents();
Expand Down
5 changes: 3 additions & 2 deletions content/browser/devtools/devtools_http_handler_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
#include "content/public/browser/devtools_target.h"
#include "content/public/common/content_client.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/user_agent.h"
#include "content/public/common/user_agent.h"
#include "grit/devtools_resources_map.h"
#include "net/base/escape.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_endpoint.h"
#include "net/server/http_server_request_info.h"
#include "net/server/http_server_response_info.h"
#include "webkit/common/user_agent/user_agent_util.h"

#if defined(OS_ANDROID)
#include "base/android/build_info.h"
Expand Down Expand Up @@ -452,7 +453,7 @@ void DevToolsHttpHandlerImpl::OnJsonRequestUI(
if (command == "version") {
base::DictionaryValue version;
version.SetString("Protocol-Version", kProtocolVersion);
version.SetString("WebKit-Version", webkit_glue::GetWebKitVersion());
version.SetString("WebKit-Version", GetWebKitVersion());
version.SetString("Browser", GetContentClient()->GetProduct());
version.SetString("User-Agent", GetContentClient()->GetUserAgent());
#if defined(OS_ANDROID)
Expand Down
7 changes: 3 additions & 4 deletions content/child/blink_platform_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,9 @@ WebString BlinkPlatformImpl::userAgent(const WebURL& url) {
return userAgent();
}

WebData BlinkPlatformImpl::parseDataURL(
const WebURL& url,
WebString& mimetype_out,
WebString& charset_out) {
WebData BlinkPlatformImpl::parseDataURL(const WebURL& url,
WebString& mimetype_out,
WebString& charset_out) {
std::string mime_type, char_set, data;
if (net::DataURL::Parse(url, &mime_type, &char_set, &data)
&& net::IsSupportedMimeType(mime_type)) {
Expand Down
1 change: 1 addition & 0 deletions content/child/npapi/plugin_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "content/child/npapi/webplugin_delegate.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/user_agent.h"
#include "content/public/common/webplugininfo.h"
#include "net/base/net_util.h"
#include "third_party/WebKit/public/web/WebBindings.h"
Expand Down
Loading

0 comments on commit efd2c3f

Please sign in to comment.