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

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

Issue 14683012: Merge 198707 "Record first run startup metrics." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1500/src/
Patch Set: 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
« no previous file with comments | « chrome/browser/ui/gtk/first_run_dialog.h ('k') | chrome/browser/ui/views/first_run_bubble.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/first_run_dialog.cc
===================================================================
--- chrome/browser/ui/gtk/first_run_dialog.cc (revision 199532)
+++ chrome/browser/ui/gtk/first_run_dialog.cc (working copy)
@@ -68,17 +68,16 @@
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 show_reporting_dialog = !metrics_reporting_pref ||
!metrics_reporting_pref->IsManaged();
- if (!show_reporting_dialog)
- return true; // Nothing to do
+ if (show_reporting_dialog) {
+ // Object deletes itself.
+ new FirstRunDialog();
+ dialog_shown = true;
- 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);
+ // 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();
+ }
#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 @@
}
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,7 +162,6 @@
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();
« no previous file with comments | « chrome/browser/ui/gtk/first_run_dialog.h ('k') | chrome/browser/ui/views/first_run_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698