OLD | NEW |
---|---|
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_browser_main_linux.h" | 5 #include "chrome/browser/chrome_browser_main_linux.h" |
6 | 6 |
7 #include "chrome/browser/system_monitor/media_transfer_protocol_device_observer_ linux.h" | 7 #include "chrome/browser/system_monitor/media_transfer_protocol_device_observer_ linux.h" |
8 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" | 8 #include "device/media_transfer_protocol/media_transfer_protocol_manager.h" |
9 | 9 |
10 #if !defined(OS_CHROMEOS) | 10 #if !defined(OS_CHROMEOS) |
(...skipping 25 matching lines...) Expand all Loading... | |
36 #if !defined(OS_CHROMEOS) | 36 #if !defined(OS_CHROMEOS) |
37 void GetLinuxDistroCallback() { | 37 void GetLinuxDistroCallback() { |
38 base::GetLinuxDistro(); // Initialize base::linux_distro if needed. | 38 base::GetLinuxDistro(); // Initialize base::linux_distro if needed. |
39 } | 39 } |
40 #endif | 40 #endif |
41 | 41 |
42 bool IsCrashReportingEnabled(const PrefService* local_state) { | 42 bool IsCrashReportingEnabled(const PrefService* local_state) { |
43 // Check whether we should initialize the crash reporter. It may be disabled | 43 // Check whether we should initialize the crash reporter. It may be disabled |
44 // through configuration policy or user preference. It must be disabled for | 44 // through configuration policy or user preference. It must be disabled for |
45 // Guest mode on Chrome OS in Stable channel. | 45 // Guest mode on Chrome OS in Stable channel. |
46 // The kHeadless environment variable overrides the decision, but only if the | 46 // Environment variables may override the decision, but only if the |
47 // crash service is under control of the user. It is used by QA testing | 47 // crash service is under control of the user. It is used by QA |
48 // infrastructure to switch on generation of crash reports. | 48 // testing infrastructure to switch on generation of crash reports. |
49 bool use_env_var = true; | |
50 | |
49 #if defined(OS_CHROMEOS) | 51 #if defined(OS_CHROMEOS) |
50 bool is_guest_session = | 52 bool is_guest_session = |
51 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); | 53 CommandLine::ForCurrentProcess()->HasSwitch(switches::kGuestSession); |
52 bool is_stable_channel = | 54 bool is_stable_channel = |
53 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; | 55 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; |
54 // TODO(pastarmovj): Consider the TrustedGet here. | 56 // TODO(pastarmovj): Consider the TrustedGet here. |
55 bool reporting_enabled; | 57 bool reporting_enabled; |
56 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, | 58 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
57 &reporting_enabled); | 59 &reporting_enabled); |
58 bool breakpad_enabled = | 60 bool breakpad_enabled = |
59 !(is_guest_session && is_stable_channel) && reporting_enabled; | 61 !(is_guest_session && is_stable_channel) && reporting_enabled; |
60 if (!breakpad_enabled) | |
61 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | |
62 #else | 62 #else |
63 const PrefService::Preference* metrics_reporting_enabled = | 63 const PrefService::Preference* metrics_reporting_enabled = |
64 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 64 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
65 CHECK(metrics_reporting_enabled); | 65 CHECK(metrics_reporting_enabled); |
66 bool breakpad_enabled = | 66 bool breakpad_enabled = |
Lei Zhang
2013/01/09 22:36:49
I'm concerned that a Chromium build can have this
Mark Seaborn
2013/01/10 00:48:28
To clarify, is your concern about when Chromium is
Lei Zhang
2013/01/10 00:58:49
My concern is about users running it on their desk
Mark Seaborn
2013/01/10 01:23:02
Oh, I thought you'd say the opposite. I'm not so
| |
67 local_state->GetBoolean(prefs::kMetricsReportingEnabled); | 67 local_state->GetBoolean(prefs::kMetricsReportingEnabled); |
68 if (!breakpad_enabled && metrics_reporting_enabled->IsUserModifiable()) | 68 use_env_var = metrics_reporting_enabled->IsUserModifiable(); |
69 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | |
70 #endif // defined(OS_CHROMEOS) | 69 #endif // defined(OS_CHROMEOS) |
70 | |
71 if (use_env_var) { | |
72 // Linux Breakpad interferes with the debug stack traces produced | |
73 // by EnableInProcessStackDumping(), used in browser_tests, so we | |
74 // do not allow CHROME_HEADLESS=1 to enable Breakpad in Chromium | |
75 // because the buildbots have CHROME_HEADLESS set. However, we | |
76 // allow CHROME_HEADLESS to enable Breakpad in Chrome for | |
77 // compatibility with Breakpad/Chrome tests that may rely on this. | |
78 // TODO(mseaborn): Change tests to use CHROME_ENABLE_BREAKPAD | |
79 // instead. | |
80 #if defined(GOOGLE_CHROME_BUILD) | |
81 if (!breakpad_enabled) | |
82 breakpad_enabled = getenv(env_vars::kHeadless) != NULL; | |
83 #endif | |
84 if (!breakpad_enabled) | |
85 breakpad_enabled = getenv("CHROME_ENABLE_BREAKPAD") != NULL; | |
Lei Zhang
2013/01/09 22:36:49
Likely some other pieces of C++ code will use this
Mark Seaborn
2013/01/10 00:48:28
OK, done.
| |
86 } | |
87 | |
71 return breakpad_enabled; | 88 return breakpad_enabled; |
72 } | 89 } |
73 #endif // defined(USE_LINUX_BREAKPAD) | 90 #endif // defined(USE_LINUX_BREAKPAD) |
74 | 91 |
75 } // namespace | 92 } // namespace |
76 | 93 |
77 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( | 94 ChromeBrowserMainPartsLinux::ChromeBrowserMainPartsLinux( |
78 const content::MainFunctionParams& parameters) | 95 const content::MainFunctionParams& parameters) |
79 : ChromeBrowserMainPartsPosix(parameters), | 96 : ChromeBrowserMainPartsPosix(parameters), |
80 did_pre_profile_init_(false) { | 97 did_pre_profile_init_(false) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 // Release it now. Otherwise the FILE thread would be gone when we try to | 142 // Release it now. Otherwise the FILE thread would be gone when we try to |
126 // release it in the dtor and Valgrind would report a leak on almost ever | 143 // release it in the dtor and Valgrind would report a leak on almost ever |
127 // single browser_test. | 144 // single browser_test. |
128 removable_device_notifications_linux_ = NULL; | 145 removable_device_notifications_linux_ = NULL; |
129 #endif | 146 #endif |
130 | 147 |
131 media_transfer_protocol_device_observer_.reset(); | 148 media_transfer_protocol_device_observer_.reset(); |
132 | 149 |
133 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); | 150 ChromeBrowserMainPartsPosix::PostMainMessageLoopRun(); |
134 } | 151 } |
OLD | NEW |