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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 296213004: Linux Breakpad: Do not pass the Linux distro to non-browser processes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | components/breakpad/app/breakpad_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" 179 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h"
180 #include "chrome/browser/chrome_browser_main_android.h" 180 #include "chrome/browser/chrome_browser_main_android.h"
181 #include "chrome/common/descriptors_android.h" 181 #include "chrome/common/descriptors_android.h"
182 #include "components/breakpad/browser/crash_dump_manager_android.h" 182 #include "components/breakpad/browser/crash_dump_manager_android.h"
183 #elif defined(OS_POSIX) 183 #elif defined(OS_POSIX)
184 #include "chrome/browser/chrome_browser_main_posix.h" 184 #include "chrome/browser/chrome_browser_main_posix.h"
185 #endif 185 #endif
186 186
187 #if defined(OS_POSIX) && !defined(OS_MACOSX) 187 #if defined(OS_POSIX) && !defined(OS_MACOSX)
188 #include "base/debug/leak_annotations.h" 188 #include "base/debug/leak_annotations.h"
189 #include "base/linux_util.h"
190 #include "components/breakpad/app/breakpad_linux.h" 189 #include "components/breakpad/app/breakpad_linux.h"
191 #include "components/breakpad/browser/crash_handler_host_linux.h" 190 #include "components/breakpad/browser/crash_handler_host_linux.h"
192 #endif 191 #endif
193 192
194 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 193 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
195 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" 194 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h"
196 #endif 195 #endif
197 196
198 #if defined(OS_ANDROID) 197 #if defined(OS_ANDROID)
199 #include "ui/base/ui_base_paths.h" 198 #include "ui/base/ui_base_paths.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 using content::FileDescriptorInfo; 264 using content::FileDescriptorInfo;
266 #endif 265 #endif
267 266
268 namespace { 267 namespace {
269 268
270 // Cached version of the locale so we can return the locale on the I/O 269 // Cached version of the locale so we can return the locale on the I/O
271 // thread. 270 // thread.
272 base::LazyInstance<std::string> g_io_thread_application_locale; 271 base::LazyInstance<std::string> g_io_thread_application_locale;
273 272
274 #if defined(ENABLE_PLUGINS) 273 #if defined(ENABLE_PLUGINS)
275 const char* kPredefinedAllowedFileHandleOrigins[] = { 274 const char* const kPredefinedAllowedFileHandleOrigins[] = {
276 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789 275 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789
277 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789 276 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789
278 }; 277 };
279 278
280 const char* kPredefinedAllowedSocketOrigins[] = { 279 const char* const kPredefinedAllowedSocketOrigins[] = {
281 "okddffdblfhhnmhodogpojmfkjmhinfp", // Test SSH Client 280 "okddffdblfhhnmhodogpojmfkjmhinfp", // Test SSH Client
282 "pnhechapfaindjhompbnflcldabbghjo", // HTerm App (SSH Client) 281 "pnhechapfaindjhompbnflcldabbghjo", // HTerm App (SSH Client)
283 "bglhmjfplikpjnfoegeomebmfnkjomhe", // see crbug.com/122126 282 "bglhmjfplikpjnfoegeomebmfnkjomhe", // see crbug.com/122126
284 "gbchcmhmhahfdphkhkmpfmihenigjmpp", // Chrome Remote Desktop 283 "gbchcmhmhahfdphkhkmpfmihenigjmpp", // Chrome Remote Desktop
285 "kgngmbheleoaphbjbaiobfdepmghbfah", // Pre-release Chrome Remote Desktop 284 "kgngmbheleoaphbjbaiobfdepmghbfah", // Pre-release Chrome Remote Desktop
286 "odkaodonbgfohohmklejpjiejmcipmib", // Dogfood Chrome Remote Desktop 285 "odkaodonbgfohohmklejpjiejmcipmib", // Dogfood Chrome Remote Desktop
287 "ojoimpklfciegopdfgeenehpalipignm", // Chromoting canary 286 "ojoimpklfciegopdfgeenehpalipignm", // Chromoting canary
288 "cbkkbcmdlboombapidmoeolnmdacpkch", // see crbug.com/129089 287 "cbkkbcmdlboombapidmoeolnmdacpkch", // see crbug.com/129089
289 "hhnbmknkdabfoieppbbljkhkfjcmcbjh", // see crbug.com/134099 288 "hhnbmknkdabfoieppbbljkhkfjcmcbjh", // see crbug.com/134099
290 "mablfbjkhmhkmefkjjacnbaikjkipphg", // see crbug.com/134099 289 "mablfbjkhmhkmefkjjacnbaikjkipphg", // see crbug.com/134099
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 return true; 474 return true;
476 } 475 }
477 return false; 476 return false;
478 } 477 }
479 478
480 #if !defined(OS_ANDROID) 479 #if !defined(OS_ANDROID)
481 // Fills |map| with the per-script font prefs under path |map_name|. 480 // Fills |map| with the per-script font prefs under path |map_name|.
482 void FillFontFamilyMap(const PrefService* prefs, 481 void FillFontFamilyMap(const PrefService* prefs,
483 const char* map_name, 482 const char* map_name,
484 webkit_glue::ScriptFontFamilyMap* map) { 483 webkit_glue::ScriptFontFamilyMap* map) {
485 // TODO: Get rid of the brute-force scan over possible (font family / script) 484 // TODO(falken): Get rid of the brute-force scan over possible
486 // combinations - see http://crbug.com/308095. 485 // (font family / script) combinations - see http://crbug.com/308095.
487 for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { 486 for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) {
488 const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; 487 const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i];
489 std::string pref_name = base::StringPrintf("%s.%s", map_name, script); 488 std::string pref_name = base::StringPrintf("%s.%s", map_name, script);
490 std::string font_family = prefs->GetString(pref_name.c_str()); 489 std::string font_family = prefs->GetString(pref_name.c_str());
491 if (!font_family.empty()) 490 if (!font_family.empty())
492 (*map)[script] = base::UTF8ToUTF16(font_family); 491 (*map)[script] = base::UTF8ToUTF16(font_family);
493 } 492 }
494 } 493 }
495 494
496 #if defined(OS_POSIX) && !defined(OS_MACOSX) 495 #if defined(OS_POSIX) && !defined(OS_MACOSX)
497 breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( 496 breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
498 const std::string& process_type) { 497 const std::string& process_type) {
499 base::FilePath dumps_path; 498 base::FilePath dumps_path;
500 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); 499 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path);
501 { 500 {
502 ANNOTATE_SCOPED_MEMORY_LEAK; 501 ANNOTATE_SCOPED_MEMORY_LEAK;
502 bool upload = (getenv(env_vars::kHeadless) == NULL);
503 breakpad::CrashHandlerHostLinux* crash_handler = 503 breakpad::CrashHandlerHostLinux* crash_handler =
504 new breakpad::CrashHandlerHostLinux( 504 new breakpad::CrashHandlerHostLinux(process_type, dumps_path, upload);
505 process_type, dumps_path, getenv(env_vars::kHeadless) == NULL);
506 crash_handler->StartUploaderThread(); 505 crash_handler->StartUploaderThread();
507 return crash_handler; 506 return crash_handler;
508 } 507 }
509 } 508 }
510 509
511 int GetCrashSignalFD(const CommandLine& command_line) { 510 int GetCrashSignalFD(const CommandLine& command_line) {
511 // Extensions have the same process type as renderers.
512 if (command_line.HasSwitch(extensions::switches::kExtensionProcess)) { 512 if (command_line.HasSwitch(extensions::switches::kExtensionProcess)) {
513 static breakpad::CrashHandlerHostLinux* crash_handler = NULL; 513 static breakpad::CrashHandlerHostLinux* crash_handler = NULL;
514 if (!crash_handler) 514 if (!crash_handler)
515 crash_handler = CreateCrashHandlerHost("extension"); 515 crash_handler = CreateCrashHandlerHost("extension");
516 return crash_handler->GetDeathSignalSocket(); 516 return crash_handler->GetDeathSignalSocket();
517 } 517 }
518 518
519 std::string process_type = 519 std::string process_type =
520 command_line.GetSwitchValueASCII(switches::kProcessType); 520 command_line.GetSwitchValueASCII(switches::kProcessType);
521 521
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 const std::string& alias_name) { 1477 const std::string& alias_name) {
1478 return CharacterEncoding::GetCanonicalEncodingNameByAliasName(alias_name); 1478 return CharacterEncoding::GetCanonicalEncodingNameByAliasName(alias_name);
1479 } 1479 }
1480 1480
1481 void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( 1481 void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
1482 CommandLine* command_line, int child_process_id) { 1482 CommandLine* command_line, int child_process_id) {
1483 #if defined(OS_POSIX) 1483 #if defined(OS_POSIX)
1484 if (breakpad::IsCrashReporterEnabled()) { 1484 if (breakpad::IsCrashReporterEnabled()) {
1485 std::string enable_crash_reporter; 1485 std::string enable_crash_reporter;
1486 GoogleUpdateSettings::GetMetricsId(&enable_crash_reporter); 1486 GoogleUpdateSettings::GetMetricsId(&enable_crash_reporter);
1487 #if !defined(OS_MACOSX)
1488 enable_crash_reporter += "," + base::GetLinuxDistro();
1489 #endif
1490 command_line->AppendSwitchASCII(switches::kEnableCrashReporter, 1487 command_line->AppendSwitchASCII(switches::kEnableCrashReporter,
1491 enable_crash_reporter); 1488 enable_crash_reporter);
1492 } 1489 }
1493 #endif // OS_POSIX 1490 #endif // defined(OS_POSIX)
1494 1491
1495 if (logging::DialogsAreSuppressed()) 1492 if (logging::DialogsAreSuppressed())
1496 command_line->AppendSwitch(switches::kNoErrorDialogs); 1493 command_line->AppendSwitch(switches::kNoErrorDialogs);
1497 1494
1498 std::string process_type = 1495 std::string process_type =
1499 command_line->GetSwitchValueASCII(switches::kProcessType); 1496 command_line->GetSwitchValueASCII(switches::kProcessType);
1500 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 1497 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
1501 1498
1502 static const char* const kCommonSwitchNames[] = { 1499 static const char* const kCommonSwitchNames[] = {
1503 switches::kUserAgent, 1500 switches::kUserAgent,
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2752 switches::kDisableWebRtcEncryption, 2749 switches::kDisableWebRtcEncryption,
2753 }; 2750 };
2754 to_command_line->CopySwitchesFrom(from_command_line, 2751 to_command_line->CopySwitchesFrom(from_command_line,
2755 kWebRtcDevSwitchNames, 2752 kWebRtcDevSwitchNames,
2756 arraysize(kWebRtcDevSwitchNames)); 2753 arraysize(kWebRtcDevSwitchNames));
2757 } 2754 }
2758 } 2755 }
2759 #endif // defined(ENABLE_WEBRTC) 2756 #endif // defined(ENABLE_WEBRTC)
2760 2757
2761 } // namespace chrome 2758 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | components/breakpad/app/breakpad_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698