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/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/metrics/metrics_reporting_state.h" |
16 #include "chrome/browser/sessions/session_restore.h" | 17 #include "chrome/browser/sessions/session_restore.h" |
17 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
18 #include "chrome/browser/ui/browser_list_observer.h" | 19 #include "chrome/browser/ui/browser_list_observer.h" |
19 #include "chrome/browser/ui/options/options_util.h" | |
20 #include "chrome/browser/ui/startup/session_crashed_bubble.h" | 20 #include "chrome/browser/ui/startup/session_crashed_bubble.h" |
21 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | 21 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
23 #include "chrome/browser/ui/views/frame/browser_view.h" | 23 #include "chrome/browser/ui/views/frame/browser_view.h" |
24 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 24 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
27 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
28 #include "chrome/installer/util/google_update_settings.h" | 28 #include "chrome/installer/util/google_update_settings.h" |
29 #include "content/public/browser/browser_context.h" | 29 #include "content/public/browser/browser_context.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } | 374 } |
375 | 375 |
376 void SessionCrashedBubbleView::RestorePreviousSession(views::Button* sender) { | 376 void SessionCrashedBubbleView::RestorePreviousSession(views::Button* sender) { |
377 SessionRestore::RestoreSessionAfterCrash(browser_); | 377 SessionRestore::RestoreSessionAfterCrash(browser_); |
378 | 378 |
379 // Record user's choice for opting in to UMA. | 379 // Record user's choice for opting in to UMA. |
380 // There's no opting-out choice in the crash restore bubble. | 380 // There's no opting-out choice in the crash restore bubble. |
381 if (uma_option_ && uma_option_->checked()) { | 381 if (uma_option_ && uma_option_->checked()) { |
382 // TODO: Clean up function ResolveMetricsReportingEnabled so that user pref | 382 // TODO: Clean up function ResolveMetricsReportingEnabled so that user pref |
383 // is stored automatically. | 383 // is stored automatically. |
384 OptionsUtil::ResolveMetricsReportingEnabled(true); | 384 ResolveMetricsReportingEnabled(true); |
385 g_browser_process->local_state()->SetBoolean( | 385 g_browser_process->local_state()->SetBoolean( |
386 prefs::kMetricsReportingEnabled, true); | 386 prefs::kMetricsReportingEnabled, true); |
387 } | 387 } |
388 CloseBubble(); | 388 CloseBubble(); |
389 } | 389 } |
390 | 390 |
391 void SessionCrashedBubbleView::CloseBubble() { | 391 void SessionCrashedBubbleView::CloseBubble() { |
392 GetWidget()->Close(); | 392 GetWidget()->Close(); |
393 } | 393 } |
394 | 394 |
395 bool ShowSessionCrashedBubble(Browser* browser) { | 395 bool ShowSessionCrashedBubble(Browser* browser) { |
396 if (IsBubbleUIEnabled()) { | 396 if (IsBubbleUIEnabled()) { |
397 SessionCrashedBubbleView::Show(browser); | 397 SessionCrashedBubbleView::Show(browser); |
398 return true; | 398 return true; |
399 } | 399 } |
400 return false; | 400 return false; |
401 } | 401 } |
OLD | NEW |