diff options
author | dpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-24 23:28:18 +0000 |
---|---|---|
committer | dpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-24 23:28:18 +0000 |
commit | 5e647e9975f3c36fcdacd4477f49ce99158289d0 (patch) | |
tree | f6e26c69bbff9d0ebe9efc6c7b964e2f34495fa8 /content | |
parent | b4001d5d19c25899403a3c5b28949d94d2aca683 (diff) | |
download | chromium_src-5e647e9975f3c36fcdacd4477f49ce99158289d0.zip chromium_src-5e647e9975f3c36fcdacd4477f49ce99158289d0.tar.gz chromium_src-5e647e9975f3c36fcdacd4477f49ce99158289d0.tar.bz2 |
Make setting the user agent work with the zygote on linux.
Previously the user agent was set when we set the content client,
which was set in the zygote, which didn't have a command line.
Now, we still set the user agent in the zygote, but if the
--user-agent command line switch is passed, we will reset the
user agent in ZygoteMain.
R=jam@chromium.org
BUG=99418
TEST=run chrome with --user-agent=foo on linux, visit
whatsmyuseragent.com, ensure 'foo' is displayed.
Review URL: http://codereview.chromium.org/8296011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107012 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/app/content_main.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/content/app/content_main.cc b/content/app/content_main.cc index 9906cdf..558bcf3 100644 --- a/content/app/content_main.cc +++ b/content/app/content_main.cc @@ -22,12 +22,14 @@ #include "content/common/sandbox_init_wrapper.h" #include "content/common/set_process_title.h" #include "content/public/app/content_main_delegate.h" +#include "content/public/common/content_client.h" #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" #include "crypto/nss_util.h" #include "ipc/ipc_switches.h" #include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_paths.h" +#include "webkit/glue/webkit_glue.h" #if defined(OS_WIN) #include <atlbase.h> @@ -203,6 +205,13 @@ int RunZygote(const MainFunctionParams& main_function_params, // line so update it here with the new version. const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + // 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. + bool custom = false; + std::string ua = content::GetContentClient()->GetUserAgent(&custom); + if (custom) webkit_glue::SetUserAgent(ua, custom); + // 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. |