Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1109)

Unified Diff: chrome/browser/ui/gtk/first_run_dialog.cc

Issue 14946003: Record first run startup metrics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/first_run_dialog.cc
diff --git a/chrome/browser/ui/gtk/first_run_dialog.cc b/chrome/browser/ui/gtk/first_run_dialog.cc
index aa4b7800490a609fe1f73c798dbefaf47cc8ff3b..79f193a5ca053035968b10aa72d921eeaa204aef 100644
--- a/chrome/browser/ui/gtk/first_run_dialog.cc
+++ b/chrome/browser/ui/gtk/first_run_dialog.cc
@@ -68,17 +68,16 @@ void SetWelcomePosition(GtkFloatingContainer* container,
namespace first_run {
-void ShowFirstRunDialog(Profile* profile) {
- FirstRunDialog::Show();
+bool ShowFirstRunDialog(Profile* profile) {
+ return FirstRunDialog::Show();
}
} // namespace first_run
// static
bool FirstRunDialog::Show() {
-#if !defined(GOOGLE_CHROME_BUILD)
- return true; // Nothing to do
-#else
+ bool dialog_shown = false;
+#if defined(GOOGLE_CHROME_BUILD)
// If the metrics reporting is managed, we won't ask.
const PrefService::Preference* metrics_reporting_pref =
g_browser_process->local_state()->FindPreference(
@@ -86,30 +85,26 @@ bool FirstRunDialog::Show() {
bool show_reporting_dialog = !metrics_reporting_pref ||
!metrics_reporting_pref->IsManaged();
- if (!show_reporting_dialog)
- return true; // Nothing to do
-
- int response = -1;
- // Object deletes itself.
- new FirstRunDialog(show_reporting_dialog, &response);
-
- // TODO(port): it should be sufficient to just run the dialog:
- // int response = gtk_dialog_run(GTK_DIALOG(dialog));
- // but that spins a nested message loop and hoses us. :(
- // http://code.google.com/p/chromium/issues/detail?id=12552
- // Instead, run a loop and extract the response manually.
- MessageLoop::current()->Run();
-
- return (response == GTK_RESPONSE_ACCEPT);
+ if (show_reporting_dialog) {
+ // Object deletes itself.
+ new FirstRunDialog();
+ dialog_shown = true;
+
+ // TODO(port): it should be sufficient to just run the dialog:
+ // int response = gtk_dialog_run(GTK_DIALOG(dialog));
+ // but that spins a nested message loop and hoses us. :(
+ // http://code.google.com/p/chromium/issues/detail?id=12552
+ // Instead, run a loop directly here.
+ MessageLoop::current()->Run();
+ }
Nico 2013/05/06 21:15:09 Is this right? Previously the dialog would call On
gab 2013/05/06 21:28:36 The response wasn't used previously. This method
Nico 2013/05/06 21:31:50 No, but it might've been called for its side effec
gab 2013/05/06 21:40:10 Hmmm, I only removed the storing of |response| int
Nico 2013/05/06 21:55:40 Ah, I didn't see tge early return if (!show_report
Mattias Nissler (ping if slow) 2013/05/07 08:27:51 I suspect I wrote that comment back in a time when
#endif // defined(GOOGLE_CHROME_BUILD)
+ return dialog_shown;
}
-FirstRunDialog::FirstRunDialog(bool show_reporting_dialog, int* response)
+FirstRunDialog::FirstRunDialog()
: dialog_(NULL),
report_crashes_(NULL),
- make_default_(NULL),
- show_reporting_dialog_(show_reporting_dialog),
- response_(response) {
+ make_default_(NULL) {
ShowReportingDialog();
}
@@ -117,16 +112,6 @@ FirstRunDialog::~FirstRunDialog() {
}
void FirstRunDialog::ShowReportingDialog() {
- // The purpose of the dialog is to ask the user to enable stats and crash
- // reporting. This setting may be controlled through configuration management
- // in enterprise scenarios. If that is the case, skip the dialog entirely,
- // it's not worth bothering the user for only the default browser question
- // (which is likely to be forced in enterprise deployments anyway).
- if (!show_reporting_dialog_) {
- OnResponseDialog(NULL, GTK_RESPONSE_ACCEPT);
- return;
- }
-
dialog_ = gtk_dialog_new_with_buttons(
l10n_util::GetStringUTF8(IDS_FIRSTRUN_DLG_TITLE).c_str(),
NULL, // No parent
@@ -177,10 +162,6 @@ void FirstRunDialog::ShowReportingDialog() {
void FirstRunDialog::OnResponseDialog(GtkWidget* widget, int response) {
if (dialog_)
gtk_widget_hide_all(dialog_);
- *response_ = response;
-
- // Mark that first run has ran.
- first_run::CreateSentinel();
// Check if user has opted into reporting.
if (report_crashes_ &&

Powered by Google App Engine
This is Rietveld 408576698