OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gtk/first_run_dialog.h" | 5 #include "chrome/browser/ui/gtk/first_run_dialog.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/app/breakpad_linux.h" |
13 #include "chrome/browser/first_run/first_run_dialog.h" | 14 #include "chrome/browser/first_run/first_run_dialog.h" |
14 #include "chrome/browser/platform_util.h" | 15 #include "chrome/browser/platform_util.h" |
15 #include "chrome/browser/process_singleton.h" | 16 #include "chrome/browser/process_singleton.h" |
16 #include "chrome/browser/shell_integration.h" | 17 #include "chrome/browser/shell_integration.h" |
17 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 18 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
18 #include "chrome/browser/ui/gtk/gtk_util.h" | 19 #include "chrome/browser/ui/gtk/gtk_util.h" |
19 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
20 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
21 #include "chrome/installer/util/google_update_settings.h" | 22 #include "chrome/installer/util/google_update_settings.h" |
22 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
24 #include "grit/locale_settings.h" | 25 #include "grit/locale_settings.h" |
25 #include "grit/theme_resources.h" | 26 #include "grit/theme_resources.h" |
26 #include "ui/base/gtk/gtk_floating_container.h" | 27 #include "ui/base/gtk/gtk_floating_container.h" |
27 #include "ui/base/gtk/gtk_hig_constants.h" | 28 #include "ui/base/gtk/gtk_hig_constants.h" |
28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
29 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
30 | 31 |
31 #if defined(USE_LINUX_BREAKPAD) | |
32 #include "chrome/app/breakpad_linux.h" | |
33 #endif | |
34 | |
35 #if defined(GOOGLE_CHROME_BUILD) | 32 #if defined(GOOGLE_CHROME_BUILD) |
36 #include "base/prefs/pref_service.h" | 33 #include "base/prefs/pref_service.h" |
37 #include "chrome/browser/browser_process.h" | 34 #include "chrome/browser/browser_process.h" |
38 #endif | 35 #endif |
39 | 36 |
40 namespace { | 37 namespace { |
41 | 38 |
42 // Set the (x, y) coordinates of the welcome message (which floats on top of | 39 // Set the (x, y) coordinates of the welcome message (which floats on top of |
43 // the omnibox image at the top of the first run dialog). | 40 // the omnibox image at the top of the first run dialog). |
44 void SetWelcomePosition(GtkFloatingContainer* container, | 41 void SetWelcomePosition(GtkFloatingContainer* container, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 void FirstRunDialog::OnResponseDialog(GtkWidget* widget, int response) { | 159 void FirstRunDialog::OnResponseDialog(GtkWidget* widget, int response) { |
163 if (dialog_) | 160 if (dialog_) |
164 gtk_widget_hide_all(dialog_); | 161 gtk_widget_hide_all(dialog_); |
165 | 162 |
166 // Mark that first run has ran. | 163 // Mark that first run has ran. |
167 first_run::CreateSentinel(); | 164 first_run::CreateSentinel(); |
168 | 165 |
169 // Check if user has opted into reporting. | 166 // Check if user has opted into reporting. |
170 if (report_crashes_ && | 167 if (report_crashes_ && |
171 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(report_crashes_))) { | 168 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(report_crashes_))) { |
172 #if defined(USE_LINUX_BREAKPAD) | |
173 if (GoogleUpdateSettings::SetCollectStatsConsent(true)) | 169 if (GoogleUpdateSettings::SetCollectStatsConsent(true)) |
174 InitCrashReporter(); | 170 InitCrashReporter(); |
175 #endif | |
176 } else { | 171 } else { |
177 GoogleUpdateSettings::SetCollectStatsConsent(false); | 172 GoogleUpdateSettings::SetCollectStatsConsent(false); |
178 } | 173 } |
179 | 174 |
180 // If selected set as default browser. | 175 // If selected set as default browser. |
181 if (make_default_ && | 176 if (make_default_ && |
182 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(make_default_))) { | 177 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(make_default_))) { |
183 ShellIntegration::SetAsDefaultBrowser(); | 178 ShellIntegration::SetAsDefaultBrowser(); |
184 } | 179 } |
185 | 180 |
186 FirstRunDone(); | 181 FirstRunDone(); |
187 } | 182 } |
188 | 183 |
189 void FirstRunDialog::OnLearnMoreLinkClicked(GtkButton* button) { | 184 void FirstRunDialog::OnLearnMoreLinkClicked(GtkButton* button) { |
190 platform_util::OpenExternal(GURL(chrome::kLearnMoreReportingURL)); | 185 platform_util::OpenExternal(GURL(chrome::kLearnMoreReportingURL)); |
191 } | 186 } |
192 | 187 |
193 void FirstRunDialog::FirstRunDone() { | 188 void FirstRunDialog::FirstRunDone() { |
194 first_run::SetShouldShowWelcomePage(); | 189 first_run::SetShouldShowWelcomePage(); |
195 | 190 |
196 if (dialog_) | 191 if (dialog_) |
197 gtk_widget_destroy(dialog_); | 192 gtk_widget_destroy(dialog_); |
198 base::MessageLoop::current()->Quit(); | 193 base::MessageLoop::current()->Quit(); |
199 delete this; | 194 delete this; |
200 } | 195 } |
OLD | NEW |