Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Unified Diff: headless/lib/browser/headless_content_browser_client.cc

Issue 2805793003: Add user-agent flag to headless (Closed)
Patch Set: Add shell switches to build file Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « headless/lib/browser/headless_browser_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/browser/headless_content_browser_client.cc
diff --git a/headless/lib/browser/headless_content_browser_client.cc b/headless/lib/browser/headless_content_browser_client.cc
index 5876199424bb691c0a56ce85a1004afc8f75f896..9d0dde7952b36c3c786425f67356fc0918bca43d 100644
--- a/headless/lib/browser/headless_content_browser_client.cc
+++ b/headless/lib/browser/headless_content_browser_client.cc
@@ -20,6 +20,7 @@
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/service_names.mojom.h"
+#include "headless/app/headless_shell_switches.h"
#include "headless/grit/headless_lib_resources.h"
#include "headless/lib/browser/headless_browser_context_impl.h"
#include "headless/lib/browser/headless_browser_impl.h"
@@ -77,21 +78,21 @@ int GetCrashSignalFD(const base::CommandLine& command_line,
return -1;
std::string process_type =
- command_line.GetSwitchValueASCII(switches::kProcessType);
+ command_line.GetSwitchValueASCII(::switches::kProcessType);
- if (process_type == switches::kRendererProcess) {
+ if (process_type == ::switches::kRendererProcess) {
static breakpad::CrashHandlerHostLinux* crash_handler =
CreateCrashHandlerHost(process_type, options);
return crash_handler->GetDeathSignalSocket();
}
- if (process_type == switches::kPpapiPluginProcess) {
+ if (process_type == ::switches::kPpapiPluginProcess) {
static breakpad::CrashHandlerHostLinux* crash_handler =
CreateCrashHandlerHost(process_type, options);
return crash_handler->GetDeathSignalSocket();
}
- if (process_type == switches::kGpuProcess) {
+ if (process_type == ::switches::kGpuProcess) {
static breakpad::CrashHandlerHostLinux* crash_handler =
CreateCrashHandlerHost(process_type, options);
return crash_handler->GetDeathSignalSocket();
@@ -187,11 +188,18 @@ void HeadlessContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
void HeadlessContentBrowserClient::AppendExtraCommandLineSwitches(
base::CommandLine* command_line,
int child_process_id) {
- command_line->AppendSwitch(switches::kHeadless);
+ command_line->AppendSwitch(::switches::kHeadless);
+ const base::CommandLine& old_command_line(
+ *base::CommandLine::ForCurrentProcess());
+ if (old_command_line.HasSwitch(switches::kUserAgent)) {
+ command_line->AppendSwitchNative(
+ switches::kUserAgent,
+ old_command_line.GetSwitchValueNative(switches::kUserAgent));
+ }
#if defined(HEADLESS_USE_BREAKPAD)
// This flag tells child processes to also turn on crash reporting.
if (breakpad::IsCrashReporterEnabled())
- command_line->AppendSwitch(switches::kEnableCrashReporter);
+ command_line->AppendSwitch(::switches::kEnableCrashReporter);
#endif // defined(HEADLESS_USE_BREAKPAD)
}
« no previous file with comments | « headless/lib/browser/headless_browser_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698