diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-24 20:48:29 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-24 20:48:29 +0000 |
commit | f5db58da8a081fe91b25d7a373987c97d397f378 (patch) | |
tree | 52a8f3bea7d1ffecbc45d652e6caea2fc8dac4b3 /chrome/common/child_process.cc | |
parent | 05992b2a814db10d48e4deaeb9fea873e37bd329 (diff) | |
download | chromium_src-f5db58da8a081fe91b25d7a373987c97d397f378.zip chromium_src-f5db58da8a081fe91b25d7a373987c97d397f378.tar.gz chromium_src-f5db58da8a081fe91b25d7a373987c97d397f378.tar.bz2 |
Add a command-line switch to change the user agent.BUG=757345
Review URL: http://codereview.chromium.org/4059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2571 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/child_process.cc')
-rw-r--r-- | chrome/common/child_process.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/chrome/common/child_process.cc b/chrome/common/child_process.cc index 50f8b88..979418f 100644 --- a/chrome/common/child_process.cc +++ b/chrome/common/child_process.cc @@ -3,10 +3,15 @@ // found in the LICENSE file. #include <windows.h> + #include "chrome/common/child_process.h" #include "base/atomic_ref_count.h" #include "base/basictypes.h" +#include "base/command_line.h" +#include "base/string_util.h" +#include "chrome/common/chrome_switches.h" +#include "webkit/glue/webkit_glue.h" ChildProcess* ChildProcess::child_process_; MessageLoop* ChildProcess::main_thread_loop_; @@ -72,6 +77,13 @@ bool ChildProcess::GlobalInit(const std::wstring &channel_name, shutdown_event_ = CreateEvent(NULL, TRUE, FALSE, NULL); child_process_ = factory->Create(channel_name); + + CommandLine command_line; + if (command_line.HasSwitch(switches::kUserAgent)) { + webkit_glue::SetUserAgent(WideToUTF8( + command_line.GetSwitchValue(switches::kUserAgent))); + } + return true; } |