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/views/harmony/chrome_layout_provider.h" |
16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
17 #include "chrome/grit/chromium_strings.h" | 18 #include "chrome/grit/chromium_strings.h" |
18 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
19 #include "chrome/grit/locale_settings.h" | 20 #include "chrome/grit/locale_settings.h" |
20 #include "components/strings/grit/components_strings.h" | 21 #include "components/strings/grit/components_strings.h" |
21 #include "ui/aura/env.h" | 22 #include "ui/aura/env.h" |
22 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
23 #include "ui/aura/window_event_dispatcher.h" | 24 #include "ui/aura/window_event_dispatcher.h" |
24 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
25 #include "ui/views/controls/button/checkbox.h" | 26 #include "ui/views/controls/button/checkbox.h" |
26 #include "ui/views/controls/link.h" | 27 #include "ui/views/controls/link.h" |
27 #include "ui/views/layout/grid_layout.h" | 28 #include "ui/views/layout/grid_layout.h" |
28 #include "ui/views/layout/layout_constants.h" | |
29 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
30 #include "ui/views/window/dialog_delegate.h" | 30 #include "ui/views/window/dialog_delegate.h" |
31 | 31 |
32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
33 #include "components/crash/content/app/breakpad_win.h" | 33 #include "components/crash/content/app/breakpad_win.h" |
34 #elif defined(OS_LINUX) | 34 #elif defined(OS_LINUX) |
35 #include "components/crash/content/app/breakpad_linux.h" | 35 #include "components/crash/content/app/breakpad_linux.h" |
36 #endif | 36 #endif |
37 | 37 |
38 using views::GridLayout; | 38 using views::GridLayout; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 return dialog_shown; | 76 return dialog_shown; |
77 } | 77 } |
78 | 78 |
79 FirstRunDialog::FirstRunDialog(Profile* profile) | 79 FirstRunDialog::FirstRunDialog(Profile* profile) |
80 : profile_(profile), | 80 : profile_(profile), |
81 make_default_(NULL), | 81 make_default_(NULL), |
82 report_crashes_(NULL) { | 82 report_crashes_(NULL) { |
83 GridLayout* layout = GridLayout::CreatePanel(this); | 83 GridLayout* layout = GridLayout::CreatePanel(this); |
84 | 84 |
85 const int related_y = views::kRelatedControlVerticalSpacing; | |
86 | |
87 views::ColumnSet* column_set = layout->AddColumnSet(0); | 85 views::ColumnSet* column_set = layout->AddColumnSet(0); |
88 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0, | 86 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0, |
89 GridLayout::USE_PREF, 0, 0); | 87 GridLayout::USE_PREF, 0, 0); |
90 | 88 |
91 layout->StartRow(0, 0); | 89 layout->StartRow(0, 0); |
92 make_default_ = new views::Checkbox(l10n_util::GetStringUTF16( | 90 make_default_ = new views::Checkbox(l10n_util::GetStringUTF16( |
93 IDS_FR_CUSTOMIZE_DEFAULT_BROWSER)); | 91 IDS_FR_CUSTOMIZE_DEFAULT_BROWSER)); |
94 make_default_->SetChecked(true); | 92 make_default_->SetChecked(true); |
95 layout->AddView(make_default_); | 93 layout->AddView(make_default_); |
96 | 94 |
97 layout->StartRowWithPadding(0, 0, 0, related_y); | 95 layout->StartRowWithPadding(0, 0, 0, |
| 96 ChromeLayoutProvider::Get()->GetDistanceMetric( |
| 97 views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
98 report_crashes_ = new views::Checkbox(l10n_util::GetStringUTF16( | 98 report_crashes_ = new views::Checkbox(l10n_util::GetStringUTF16( |
99 IDS_OPTIONS_ENABLE_LOGGING)); | 99 IDS_OPTIONS_ENABLE_LOGGING)); |
100 // Having this box checked means the user has to opt-out of metrics recording. | 100 // Having this box checked means the user has to opt-out of metrics recording. |
101 report_crashes_->SetChecked(!first_run::IsMetricsReportingOptIn()); | 101 report_crashes_->SetChecked(!first_run::IsMetricsReportingOptIn()); |
102 layout->AddView(report_crashes_); | 102 layout->AddView(report_crashes_); |
103 } | 103 } |
104 | 104 |
105 FirstRunDialog::~FirstRunDialog() { | 105 FirstRunDialog::~FirstRunDialog() { |
106 } | 106 } |
107 | 107 |
(...skipping 27 matching lines...) Expand all Loading... |
135 } | 135 } |
136 | 136 |
137 void FirstRunDialog::WindowClosing() { | 137 void FirstRunDialog::WindowClosing() { |
138 first_run::SetShouldShowWelcomePage(); | 138 first_run::SetShouldShowWelcomePage(); |
139 Done(); | 139 Done(); |
140 } | 140 } |
141 | 141 |
142 void FirstRunDialog::LinkClicked(views::Link* source, int event_flags) { | 142 void FirstRunDialog::LinkClicked(views::Link* source, int event_flags) { |
143 platform_util::OpenExternal(profile_, GURL(chrome::kLearnMoreReportingURL)); | 143 platform_util::OpenExternal(profile_, GURL(chrome::kLearnMoreReportingURL)); |
144 } | 144 } |
OLD | NEW |