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

Side by Side Diff: chrome/browser/ui/views/session_crashed_bubble_view.cc

Issue 312583002: Move MetricsStateManager into the Metrics component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ui/views/session_crashed_bubble_view.h" 5 #include "chrome/browser/ui/views/session_crashed_bubble_view.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 const char kEnableBubbleUIFinchName[] = "EnableSessionCrashedBubbleUI"; 68 const char kEnableBubbleUIFinchName[] = "EnableSessionCrashedBubbleUI";
69 const char kEnableBubbleUIGroupEnabled[] = "Enabled"; 69 const char kEnableBubbleUIGroupEnabled[] = "Enabled";
70 70
71 bool ShouldOfferMetricsReporting() { 71 bool ShouldOfferMetricsReporting() {
72 // Stats collection only applies to Google Chrome builds. 72 // Stats collection only applies to Google Chrome builds.
73 #if defined(GOOGLE_CHROME_BUILD) 73 #if defined(GOOGLE_CHROME_BUILD)
74 // Only show metrics reporting option if user didn't already consent to it. 74 // Only show metrics reporting option if user didn't already consent to it.
75 if (GoogleUpdateSettings::GetCollectStatsConsent()) 75 if (GoogleUpdateSettings::GetCollectStatsConsent())
76 return false; 76 return false;
77 return g_browser_process->local_state()->FindPreference( 77 return g_browser_process->local_state()->FindPreference(
78 prefs::kMetricsReportingEnabled)->IsUserModifiable(); 78 metrics::prefs::kMetricsReportingEnabled)->IsUserModifiable();
79 #else 79 #else
80 return false; 80 return false;
81 #endif // defined(GOOGLE_CHROME_BUILD) 81 #endif // defined(GOOGLE_CHROME_BUILD)
82 } 82 }
83 83
84 // Whether or not the bubble UI should be used. 84 // Whether or not the bubble UI should be used.
85 bool IsBubbleUIEnabled() { 85 bool IsBubbleUIEnabled() {
86 const std::string group_name = base::FieldTrialList::FindFullName( 86 const std::string group_name = base::FieldTrialList::FindFullName(
87 kEnableBubbleUIFinchName); 87 kEnableBubbleUIFinchName);
88 const base::CommandLine& command_line = *CommandLine::ForCurrentProcess(); 88 const base::CommandLine& command_line = *CommandLine::ForCurrentProcess();
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 void SessionCrashedBubbleView::RestorePreviousSession(views::Button* sender) { 420 void SessionCrashedBubbleView::RestorePreviousSession(views::Button* sender) {
421 SessionRestore::RestoreSessionAfterCrash(browser_); 421 SessionRestore::RestoreSessionAfterCrash(browser_);
422 422
423 // Record user's choice for opting in to UMA. 423 // Record user's choice for opting in to UMA.
424 // There's no opting-out choice in the crash restore bubble. 424 // There's no opting-out choice in the crash restore bubble.
425 if (uma_option_ && uma_option_->checked()) { 425 if (uma_option_ && uma_option_->checked()) {
426 // TODO: Clean up function ResolveMetricsReportingEnabled so that user pref 426 // TODO: Clean up function ResolveMetricsReportingEnabled so that user pref
427 // is stored automatically. 427 // is stored automatically.
428 OptionsUtil::ResolveMetricsReportingEnabled(true); 428 OptionsUtil::ResolveMetricsReportingEnabled(true);
429 g_browser_process->local_state()->SetBoolean( 429 g_browser_process->local_state()->SetBoolean(
430 prefs::kMetricsReportingEnabled, true); 430 metrics::prefs::kMetricsReportingEnabled, true);
431 } 431 }
432 CloseBubble(); 432 CloseBubble();
433 } 433 }
434 434
435 void SessionCrashedBubbleView::CloseBubble() { 435 void SessionCrashedBubbleView::CloseBubble() {
436 GetWidget()->Close(); 436 GetWidget()->Close();
437 } 437 }
438 438
439 bool ShowSessionCrashedBubble(Browser* browser) { 439 bool ShowSessionCrashedBubble(Browser* browser) {
440 if (IsBubbleUIEnabled()) { 440 if (IsBubbleUIEnabled()) {
441 SessionCrashedBubbleView::Show(browser); 441 SessionCrashedBubbleView::Show(browser);
442 return true; 442 return true;
443 } 443 }
444 return false; 444 return false;
445 } 445 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698