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

Unified Diff: chrome/browser/ui/views/session_crashed_bubble_view.cc

Issue 369933002: Use the correct thread to access g_browser_process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scoped_ptr should be passed. Created 6 years, 5 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 | « chrome/browser/ui/views/session_crashed_bubble_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/session_crashed_bubble_view.cc
diff --git a/chrome/browser/ui/views/session_crashed_bubble_view.cc b/chrome/browser/ui/views/session_crashed_bubble_view.cc
index d1c9a5a731f8af100b2e5e5a87797b3e3ed85d51..0b12796e6690b4ba948149c407898b7b0335b26b 100644
--- a/chrome/browser/ui/views/session_crashed_bubble_view.cc
+++ b/chrome/browser/ui/views/session_crashed_bubble_view.cc
@@ -65,19 +65,6 @@ const SkColor kTextColor = SkColorSetRGB(102, 102, 102);
const char kEnableBubbleUIFinchName[] = "EnableSessionCrashedBubbleUI";
const char kEnableBubbleUIGroupEnabled[] = "Enabled";
-bool ShouldOfferMetricsReporting() {
-// Stats collection only applies to Google Chrome builds.
-#if defined(GOOGLE_CHROME_BUILD)
- // Only show metrics reporting option if user didn't already consent to it.
- if (GoogleUpdateSettings::GetCollectStatsConsent())
- return false;
- return g_browser_process->local_state()->FindPreference(
- prefs::kMetricsReportingEnabled)->IsUserModifiable();
-#else
- return false;
-#endif // defined(GOOGLE_CHROME_BUILD)
-}
-
// Whether or not the bubble UI should be used.
bool IsBubbleUIEnabled() {
const base::CommandLine& command_line = *CommandLine::ForCurrentProcess();
@@ -129,21 +116,37 @@ void SessionCrashedBubbleView::Show(Browser* browser) {
scoped_ptr<BrowserRemovalObserver> browser_observer(
new BrowserRemovalObserver(browser));
+// Stats collection only applies to Google Chrome builds.
+#if defined(GOOGLE_CHROME_BUILD)
// Schedule a task to run ShouldOfferMetricsReporting() on FILE thread, since
// GoogleUpdateSettings::GetCollectStatsConsent() does IO. Then, call
// SessionCrashedBubbleView::ShowForReal with the result.
content::BrowserThread::PostTaskAndReplyWithResult(
content::BrowserThread::FILE,
FROM_HERE,
- base::Bind(&ShouldOfferMetricsReporting),
+ base::Bind(&GoogleUpdateSettings::GetCollectStatsConsent),
base::Bind(&SessionCrashedBubbleView::ShowForReal,
base::Passed(&browser_observer)));
+#else
+ SessionCrashedBubbleView::ShowForReal(browser_observer.Pass(), false);
+#endif // defined(GOOGLE_CHROME_BUILD)
}
// static
void SessionCrashedBubbleView::ShowForReal(
scoped_ptr<BrowserRemovalObserver> browser_observer,
- bool offer_uma_optin) {
+ bool uma_opted_in_already) {
+ // Determine whether or not the uma opt-in option should be offered. It is
+ // offered only when it is a Google chrome build, user hasn't opted in yet,
+ // and the preference is modifiable by the user.
+ bool offer_uma_optin = false;
+
+#if defined(GOOGLE_CHROME_BUILD)
+ if (!uma_opted_in_already)
+ offer_uma_optin = g_browser_process->local_state()->FindPreference(
+ prefs::kMetricsReportingEnabled)->IsUserModifiable();
+#endif // defined(GOOGLE_CHROME_BUILD)
+
Browser* browser = browser_observer->browser();
if (!browser)
« no previous file with comments | « chrome/browser/ui/views/session_crashed_bubble_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698