| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 SESSION_CRASHED_BUBBLE_MAX, | 84 SESSION_CRASHED_BUBBLE_MAX, |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 void RecordBubbleHistogramValue(SessionCrashedBubbleHistogramValue value) { | 87 void RecordBubbleHistogramValue(SessionCrashedBubbleHistogramValue value) { |
| 88 UMA_HISTOGRAM_ENUMERATION( | 88 UMA_HISTOGRAM_ENUMERATION( |
| 89 "SessionCrashed.Bubble", value, SESSION_CRASHED_BUBBLE_MAX); | 89 "SessionCrashed.Bubble", value, SESSION_CRASHED_BUBBLE_MAX); |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Whether or not the bubble UI should be used. | 92 // Whether or not the bubble UI should be used. |
| 93 bool IsBubbleUIEnabled() { | 93 bool IsBubbleUIEnabled() { |
| 94 // Function InitiateMetricsReportingChange (called when the user chooses to | 94 // Function ChangeMetricsReportingState (called when the user chooses to |
| 95 // opt-in to UMA) does not support Chrome OS yet, so don't show the bubble on | 95 // opt-in to UMA) does not support Chrome OS yet, so don't show the bubble on |
| 96 // Chrome OS. | 96 // Chrome OS. |
| 97 #if defined(OS_CHROMEOS) | 97 #if defined(OS_CHROMEOS) |
| 98 return false; | 98 return false; |
| 99 #else | 99 #else |
| 100 const base::CommandLine& command_line = | 100 const base::CommandLine& command_line = |
| 101 *base::CommandLine::ForCurrentProcess(); | 101 *base::CommandLine::ForCurrentProcess(); |
| 102 if (command_line.HasSwitch(switches::kDisableSessionCrashedBubble)) | 102 if (command_line.HasSwitch(switches::kDisableSessionCrashedBubble)) |
| 103 return false; | 103 return false; |
| 104 if (command_line.HasSwitch(switches::kEnableSessionCrashedBubble)) | 104 if (command_line.HasSwitch(switches::kEnableSessionCrashedBubble)) |
| 105 return true; | 105 return true; |
| 106 const std::string group_name = base::FieldTrialList::FindFullName( | 106 const std::string group_name = base::FieldTrialList::FindFullName( |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 } | 403 } |
| 404 | 404 |
| 405 void SessionCrashedBubbleView::RestorePreviousSession() { | 405 void SessionCrashedBubbleView::RestorePreviousSession() { |
| 406 SessionRestore::RestoreSessionAfterCrash(browser_); | 406 SessionRestore::RestoreSessionAfterCrash(browser_); |
| 407 RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_RESTORED); | 407 RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_RESTORED); |
| 408 restored_ = true; | 408 restored_ = true; |
| 409 | 409 |
| 410 // Record user's choice for opt-in in to UMA. | 410 // Record user's choice for opt-in in to UMA. |
| 411 // There's no opt-out choice in the crash restore bubble. | 411 // There's no opt-out choice in the crash restore bubble. |
| 412 if (uma_option_ && uma_option_->checked()) { | 412 if (uma_option_ && uma_option_->checked()) { |
| 413 InitiateMetricsReportingChange(true, OnMetricsReportingCallbackType()); | 413 ChangeMetricsReportingState(true); |
| 414 RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_UMA_OPTIN); | 414 RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_UMA_OPTIN); |
| 415 } | 415 } |
| 416 CloseBubble(); | 416 CloseBubble(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 void SessionCrashedBubbleView::CloseBubble() { | 419 void SessionCrashedBubbleView::CloseBubble() { |
| 420 GetWidget()->Close(); | 420 GetWidget()->Close(); |
| 421 } | 421 } |
| OLD | NEW |