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

Side by Side Diff: headless/lib/browser/headless_content_browser_client.cc

Issue 2777783002: Remove user agent from HeadlessBrowserContextOptions. (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « headless/lib/browser/headless_browser_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "headless/lib/browser/headless_content_browser_client.h" 5 #include "headless/lib/browser/headless_content_browser_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <unordered_set> 8 #include <unordered_set>
9 9
10 #include "base/base_switches.h" 10 #include "base/base_switches.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/path_service.h" 15 #include "base/path_service.h"
16 #include "content/public/browser/browser_context.h" 16 #include "content/public/browser/browser_context.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
19 #include "content/public/browser/render_view_host.h" 19 #include "content/public/browser/render_view_host.h"
20 #include "content/public/browser/storage_partition.h" 20 #include "content/public/browser/storage_partition.h"
21 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
22 #include "content/public/common/service_names.mojom.h" 22 #include "content/public/common/service_names.mojom.h"
23 #include "headless/app/headless_shell_switches.h"
23 #include "headless/grit/headless_lib_resources.h" 24 #include "headless/grit/headless_lib_resources.h"
24 #include "headless/lib/browser/headless_browser_context_impl.h" 25 #include "headless/lib/browser/headless_browser_context_impl.h"
25 #include "headless/lib/browser/headless_browser_impl.h" 26 #include "headless/lib/browser/headless_browser_impl.h"
26 #include "headless/lib/browser/headless_browser_main_parts.h" 27 #include "headless/lib/browser/headless_browser_main_parts.h"
27 #include "headless/lib/browser/headless_devtools_manager_delegate.h" 28 #include "headless/lib/browser/headless_devtools_manager_delegate.h"
28 #include "headless/lib/headless_macros.h" 29 #include "headless/lib/headless_macros.h"
29 #include "storage/browser/quota/quota_settings.h" 30 #include "storage/browser/quota/quota_settings.h"
30 #include "ui/base/resource/resource_bundle.h" 31 #include "ui/base/resource/resource_bundle.h"
31 #include "ui/gfx/switches.h" 32 #include "ui/gfx/switches.h"
32 33
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return crash_handler; 71 return crash_handler;
71 } 72 }
72 } 73 }
73 74
74 int GetCrashSignalFD(const base::CommandLine& command_line, 75 int GetCrashSignalFD(const base::CommandLine& command_line,
75 const HeadlessBrowser::Options& options) { 76 const HeadlessBrowser::Options& options) {
76 if (!breakpad::IsCrashReporterEnabled()) 77 if (!breakpad::IsCrashReporterEnabled())
77 return -1; 78 return -1;
78 79
79 std::string process_type = 80 std::string process_type =
80 command_line.GetSwitchValueASCII(switches::kProcessType); 81 command_line.GetSwitchValueASCII(::switches::kProcessType);
81 82
82 if (process_type == switches::kRendererProcess) { 83 if (process_type == ::switches::kRendererProcess) {
83 static breakpad::CrashHandlerHostLinux* crash_handler = 84 static breakpad::CrashHandlerHostLinux* crash_handler =
84 CreateCrashHandlerHost(process_type, options); 85 CreateCrashHandlerHost(process_type, options);
85 return crash_handler->GetDeathSignalSocket(); 86 return crash_handler->GetDeathSignalSocket();
86 } 87 }
87 88
88 if (process_type == switches::kPpapiPluginProcess) { 89 if (process_type == ::switches::kPpapiPluginProcess) {
89 static breakpad::CrashHandlerHostLinux* crash_handler = 90 static breakpad::CrashHandlerHostLinux* crash_handler =
90 CreateCrashHandlerHost(process_type, options); 91 CreateCrashHandlerHost(process_type, options);
91 return crash_handler->GetDeathSignalSocket(); 92 return crash_handler->GetDeathSignalSocket();
92 } 93 }
93 94
94 if (process_type == switches::kGpuProcess) { 95 if (process_type == ::switches::kGpuProcess) {
95 static breakpad::CrashHandlerHostLinux* crash_handler = 96 static breakpad::CrashHandlerHostLinux* crash_handler =
96 CreateCrashHandlerHost(process_type, options); 97 CreateCrashHandlerHost(process_type, options);
97 return crash_handler->GetDeathSignalSocket(); 98 return crash_handler->GetDeathSignalSocket();
98 } 99 }
99 100
100 return -1; 101 return -1;
101 } 102 }
102 #endif // defined(HEADLESS_USE_BREAKPAD) 103 #endif // defined(HEADLESS_USE_BREAKPAD)
103 104
104 } // namespace 105 } // namespace
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 int crash_signal_fd = GetCrashSignalFD(command_line, *browser_->options()); 181 int crash_signal_fd = GetCrashSignalFD(command_line, *browser_->options());
181 if (crash_signal_fd >= 0) 182 if (crash_signal_fd >= 0)
182 mappings->Share(kCrashDumpSignal, crash_signal_fd); 183 mappings->Share(kCrashDumpSignal, crash_signal_fd);
183 #endif // defined(HEADLESS_USE_BREAKPAD) 184 #endif // defined(HEADLESS_USE_BREAKPAD)
184 } 185 }
185 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) 186 #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
186 187
187 void HeadlessContentBrowserClient::AppendExtraCommandLineSwitches( 188 void HeadlessContentBrowserClient::AppendExtraCommandLineSwitches(
188 base::CommandLine* command_line, 189 base::CommandLine* command_line,
189 int child_process_id) { 190 int child_process_id) {
190 command_line->AppendSwitch(switches::kHeadless); 191 command_line->AppendSwitch(::switches::kHeadless);
192 command_line->AppendSwitchNative(switches::kUserAgent,
Sami 2017/03/27 15:52:08 I'm wondering how things worked before when we did
irisu 2017/03/29 05:51:33 It looks as though the user agent header is set us
Sami 2017/03/29 10:46:07 That's right, that's the default user agent for th
irisu 2017/03/30 07:06:07 Removed user agent from BrowserContextOptions. I'
193 browser_->options()->user_agent);
191 #if defined(HEADLESS_USE_BREAKPAD) 194 #if defined(HEADLESS_USE_BREAKPAD)
192 // This flag tells child processes to also turn on crash reporting. 195 // This flag tells child processes to also turn on crash reporting.
193 if (breakpad::IsCrashReporterEnabled()) 196 if (breakpad::IsCrashReporterEnabled())
194 command_line->AppendSwitch(switches::kEnableCrashReporter); 197 command_line->AppendSwitch(::switches::kEnableCrashReporter);
195 #endif // defined(HEADLESS_USE_BREAKPAD) 198 #endif // defined(HEADLESS_USE_BREAKPAD)
196 } 199 }
197 200
198 } // namespace headless 201 } // namespace headless
OLDNEW
« 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