| 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/first_run_dialog.h" | 5 #include "chrome/browser/ui/views/first_run_dialog.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "chrome/browser/first_run/first_run.h" | 12 #include "chrome/browser/first_run/first_run.h" |
| 13 #include "chrome/browser/metrics/metrics_reporting_state.h" | 13 #include "chrome/browser/metrics/metrics_reporting_state.h" |
| 14 #include "chrome/browser/platform_util.h" | 14 #include "chrome/browser/platform_util.h" |
| 15 #include "chrome/browser/shell_integration.h" | 15 #include "chrome/browser/shell_integration.h" |
| 16 #include "chrome/browser/ui/browser_dialogs.h" |
| 16 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 17 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 18 #include "chrome/grit/chromium_strings.h" | 19 #include "chrome/grit/chromium_strings.h" |
| 19 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
| 20 #include "chrome/grit/locale_settings.h" | 21 #include "chrome/grit/locale_settings.h" |
| 21 #include "components/strings/grit/components_strings.h" | 22 #include "components/strings/grit/components_strings.h" |
| 22 #include "ui/aura/env.h" | 23 #include "ui/aura/env.h" |
| 23 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
| 24 #include "ui/aura/window_event_dispatcher.h" | 25 #include "ui/aura/window_event_dispatcher.h" |
| 25 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 layout->AddView(make_default_); | 94 layout->AddView(make_default_); |
| 94 | 95 |
| 95 layout->StartRowWithPadding(0, 0, 0, | 96 layout->StartRowWithPadding(0, 0, 0, |
| 96 ChromeLayoutProvider::Get()->GetDistanceMetric( | 97 ChromeLayoutProvider::Get()->GetDistanceMetric( |
| 97 views::DISTANCE_RELATED_CONTROL_VERTICAL)); | 98 views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| 98 report_crashes_ = new views::Checkbox(l10n_util::GetStringUTF16( | 99 report_crashes_ = new views::Checkbox(l10n_util::GetStringUTF16( |
| 99 IDS_OPTIONS_ENABLE_LOGGING)); | 100 IDS_OPTIONS_ENABLE_LOGGING)); |
| 100 // Having this box checked means the user has to opt-out of metrics recording. | 101 // Having this box checked means the user has to opt-out of metrics recording. |
| 101 report_crashes_->SetChecked(!first_run::IsMetricsReportingOptIn()); | 102 report_crashes_->SetChecked(!first_run::IsMetricsReportingOptIn()); |
| 102 layout->AddView(report_crashes_); | 103 layout->AddView(report_crashes_); |
| 104 chrome::RecordDialogCreation(chrome::DialogIdentifier::FIRST_RUN_DIALOG); |
| 103 } | 105 } |
| 104 | 106 |
| 105 FirstRunDialog::~FirstRunDialog() { | 107 FirstRunDialog::~FirstRunDialog() { |
| 106 } | 108 } |
| 107 | 109 |
| 108 void FirstRunDialog::Done() { | 110 void FirstRunDialog::Done() { |
| 109 CHECK(!quit_runloop_.is_null()); | 111 CHECK(!quit_runloop_.is_null()); |
| 110 quit_runloop_.Run(); | 112 quit_runloop_.Run(); |
| 111 } | 113 } |
| 112 | 114 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 135 } | 137 } |
| 136 | 138 |
| 137 void FirstRunDialog::WindowClosing() { | 139 void FirstRunDialog::WindowClosing() { |
| 138 first_run::SetShouldShowWelcomePage(); | 140 first_run::SetShouldShowWelcomePage(); |
| 139 Done(); | 141 Done(); |
| 140 } | 142 } |
| 141 | 143 |
| 142 void FirstRunDialog::LinkClicked(views::Link* source, int event_flags) { | 144 void FirstRunDialog::LinkClicked(views::Link* source, int event_flags) { |
| 143 platform_util::OpenExternal(profile_, GURL(chrome::kLearnMoreReportingURL)); | 145 platform_util::OpenExternal(profile_, GURL(chrome::kLearnMoreReportingURL)); |
| 144 } | 146 } |
| OLD | NEW |