diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-09 20:10:41 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-09 20:10:41 +0000 |
commit | 69078b8d2c607abde0fdedb08930598438e25f5f (patch) | |
tree | 16369fd439f1630837aa767cc4ce5ceb8f31f233 /content/app | |
parent | 8a820c8276581a82f263c7e3603ab4bc73a221db (diff) | |
download | chromium_src-69078b8d2c607abde0fdedb08930598438e25f5f.zip chromium_src-69078b8d2c607abde0fdedb08930598438e25f5f.tar.gz chromium_src-69078b8d2c607abde0fdedb08930598438e25f5f.tar.bz2 |
Revert 255858 "Simplify the user agent code some more since afte..."
There are some browser_tests failures on the buildbots that don't reproduce locally. Reverting while I investigate.
> Simplify the user agent code some more since after r255534 it's not affected by the site's URL.
>
> Code in content always gets it now from ContentClient::GetUserAgent. In Chrome, there's a GetUserAgent function which returns it.
>
> BUG=338338
> R=isherman@chromium.org, pauljensen@chromium.org, scottmg@chromium.org, tfarina@chromium.org
>
> Review URL: https://codereview.chromium.org/191093002
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/192283002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255867 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/app')
-rw-r--r-- | content/app/content_main_runner.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index 13d112ab..aca3c79 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc @@ -51,6 +51,7 @@ #include "ui/base/ui_base_paths.h" #include "ui/base/ui_base_switches.h" #include "ui/gfx/win/dpi.h" +#include "webkit/common/user_agent/user_agent.h" #if defined(USE_TCMALLOC) #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" @@ -379,6 +380,14 @@ int RunZygote(const MainFunctionParams& main_function_params, command_line.GetSwitchValueASCII(switches::kProcessType); ContentClientInitializer::Set(process_type, delegate); + // If a custom user agent was passed on the command line, we need + // to (re)set it now, rather than using the default one the zygote + // initialized. + if (command_line.HasSwitch(switches::kUserAgent)) { + webkit_glue::SetUserAgent( + command_line.GetSwitchValueASCII(switches::kUserAgent)); + } + // The StatsTable must be initialized in each process; we already // initialized for the browser process, now we need to initialize // within the new processes as well. @@ -738,6 +747,14 @@ class ContentMainRunnerImpl : public ContentMainRunner { if (delegate_) delegate_->PreSandboxStartup(); + // Set any custom user agent passed on the command line now so the string + // doesn't change between calls to webkit_glue::GetUserAgent(), otherwise it + // defaults to the user agent set during SetContentClient(). + if (command_line.HasSwitch(switches::kUserAgent)) { + webkit_glue::SetUserAgent( + command_line.GetSwitchValueASCII(switches::kUserAgent)); + } + if (!process_type.empty()) CommonSubprocessInit(process_type); |