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 <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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/metrics/metrics_reporting_state.h" |
17 #include "chrome/browser/sessions/session_restore.h" | 18 #include "chrome/browser/sessions/session_restore.h" |
18 #include "chrome/browser/ui/browser_list.h" | 19 #include "chrome/browser/ui/browser_list.h" |
19 #include "chrome/browser/ui/browser_list_observer.h" | 20 #include "chrome/browser/ui/browser_list_observer.h" |
20 #include "chrome/browser/ui/options/options_util.h" | |
21 #include "chrome/browser/ui/startup/session_crashed_bubble.h" | 21 #include "chrome/browser/ui/startup/session_crashed_bubble.h" |
22 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | 22 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
24 #include "chrome/browser/ui/views/frame/browser_view.h" | 24 #include "chrome/browser/ui/views/frame/browser_view.h" |
25 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 25 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
29 #include "chrome/installer/util/google_update_settings.h" | 29 #include "chrome/installer/util/google_update_settings.h" |
30 #include "content/public/browser/browser_context.h" | 30 #include "content/public/browser/browser_context.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 void SessionCrashedBubbleView::RestorePreviousSession(views::Button* sender) { | 414 void SessionCrashedBubbleView::RestorePreviousSession(views::Button* sender) { |
415 SessionRestore::RestoreSessionAfterCrash(browser_); | 415 SessionRestore::RestoreSessionAfterCrash(browser_); |
416 RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_RESTORED); | 416 RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_RESTORED); |
417 restored_ = true; | 417 restored_ = true; |
418 | 418 |
419 // Record user's choice for opting in to UMA. | 419 // Record user's choice for opting in to UMA. |
420 // There's no opting-out choice in the crash restore bubble. | 420 // There's no opting-out choice in the crash restore bubble. |
421 if (uma_option_ && uma_option_->checked()) { | 421 if (uma_option_ && uma_option_->checked()) { |
422 // TODO: Clean up function ResolveMetricsReportingEnabled so that user pref | 422 // TODO: Clean up function ResolveMetricsReportingEnabled so that user pref |
423 // is stored automatically. | 423 // is stored automatically. |
424 OptionsUtil::ResolveMetricsReportingEnabled(true); | 424 ResolveMetricsReportingEnabled(true); |
425 g_browser_process->local_state()->SetBoolean( | 425 g_browser_process->local_state()->SetBoolean( |
426 prefs::kMetricsReportingEnabled, true); | 426 prefs::kMetricsReportingEnabled, true); |
427 RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_UMA_OPTIN); | 427 RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_UMA_OPTIN); |
428 } | 428 } |
429 CloseBubble(); | 429 CloseBubble(); |
430 } | 430 } |
431 | 431 |
432 void SessionCrashedBubbleView::CloseBubble() { | 432 void SessionCrashedBubbleView::CloseBubble() { |
433 GetWidget()->Close(); | 433 GetWidget()->Close(); |
434 } | 434 } |
435 | 435 |
436 bool ShowSessionCrashedBubble(Browser* browser) { | 436 bool ShowSessionCrashedBubble(Browser* browser) { |
437 if (IsBubbleUIEnabled()) { | 437 if (IsBubbleUIEnabled()) { |
438 SessionCrashedBubbleView::Show(browser); | 438 SessionCrashedBubbleView::Show(browser); |
439 return true; | 439 return true; |
440 } | 440 } |
441 return false; | 441 return false; |
442 } | 442 } |
OLD | NEW |