diff options
author | tyoshino@chromium.org <tyoshino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-19 04:32:29 +0000 |
---|---|---|
committer | tyoshino@chromium.org <tyoshino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-19 04:32:29 +0000 |
commit | f12cb6439d837429037975c44956425d6a9f34c0 (patch) | |
tree | 899840567c35a5e93df29ffd19eccfbbabbb187a /chrome/browser/gtk | |
parent | b17e19920b54ca8b92d73dcb1cc03dae1d6b7ad0 (diff) | |
download | chromium_src-f12cb6439d837429037975c44956425d6a9f34c0.zip chromium_src-f12cb6439d837429037975c44956425d6a9f34c0.tar.gz chromium_src-f12cb6439d837429037975c44956425d6a9f34c0.tar.bz2 |
Revert 63005 - If default search is managed, we should not asked the user to choose it at First Run. Make sure the minimum bubble is not showed if there is no default search.
BUG=49306
TEST=Set a managed default search provider. Clear your Chromium user data directory (~/Library/Chromium, ~/.config/chromium, %localappdata%\Chromium) and the "First Run" file found next to the executable. Start Chrome. It should not ask you to choose a default search provider. Disable the default search provider via policy. Make sure the minimal bubble is not shown. Redo these tests for the GOOGLE_CHROME_BUILD to make sure that we still ask about usage stats.
Review URL: http://codereview.chromium.org/3565013
TBR=jeanluc@google.com
Review URL: http://codereview.chromium.org/3747009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63016 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r-- | chrome/browser/gtk/first_run_dialog.cc | 52 | ||||
-rw-r--r-- | chrome/browser/gtk/first_run_dialog.h | 13 |
2 files changed, 19 insertions, 46 deletions
diff --git a/chrome/browser/gtk/first_run_dialog.cc b/chrome/browser/gtk/first_run_dialog.cc index 45b0589..c30da15 100644 --- a/chrome/browser/gtk/first_run_dialog.cc +++ b/chrome/browser/gtk/first_run_dialog.cc @@ -86,32 +86,9 @@ void SetWelcomePosition(GtkFloatingContainer* container, // static bool FirstRunDialog::Show(Profile* profile, bool randomize_search_engine_order) { - // Figure out which dialogs we will show. - // If the default search is managed via policy, we won't ask. - const TemplateURLModel* search_engines_model = profile->GetTemplateURLModel(); - bool show_search_engines_dialog = search_engines_model && - !search_engines_model->is_default_search_managed(); - -#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( - prefs::kMetricsReportingEnabled); - bool show_reporting_dialog = !metrics_reporting_pref || - !metrics_reporting_pref->IsManaged(); -#else - bool show_reporting_dialog = false; -#endif - - if (!show_search_engines_dialog && !show_reporting_dialog) - return true; // Nothing to do - int response = -1; // Object deletes itself. - new FirstRunDialog(profile, - show_reporting_dialog, - show_search_engines_dialog, - &response); + new FirstRunDialog(profile, randomize_search_engine_order, response); // TODO(port): it should be sufficient to just run the dialog: // int response = gtk_dialog_run(GTK_DIALOG(dialog)); @@ -124,23 +101,16 @@ bool FirstRunDialog::Show(Profile* profile, } FirstRunDialog::FirstRunDialog(Profile* profile, - bool show_reporting_dialog, - bool show_search_engines_dialog, - int* response) + bool randomize_search_engine_order, + int& response) : search_engine_window_(NULL), dialog_(NULL), report_crashes_(NULL), make_default_(NULL), profile_(profile), chosen_search_engine_(NULL), - show_reporting_dialog_(show_reporting_dialog), response_(response) { - if (!show_search_engines_dialog) { - ShowReportingDialog(); - return; - } search_engines_model_ = profile_->GetTemplateURLModel(); - ShowSearchEngineWindow(); search_engines_model_->AddObserver(this); @@ -221,17 +191,21 @@ void FirstRunDialog::ShowSearchEngineWindow() { gtk_window_present(GTK_WINDOW(search_engine_window_)); } -void FirstRunDialog::ShowReportingDialog() { +void FirstRunDialog::ShowDialog() { // 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_) { + const PrefService::Preference* metrics_reporting_pref = + g_browser_process->local_state()->FindPreference( + prefs::kMetricsReportingEnabled); + if (metrics_reporting_pref && metrics_reporting_pref->IsManaged()) { OnResponseDialog(NULL, GTK_RESPONSE_ACCEPT); return; } +#if defined(GOOGLE_CHROME_BUILD) dialog_ = gtk_dialog_new_with_buttons( l10n_util::GetStringUTF8(IDS_FIRSTRUN_DLG_TITLE).c_str(), NULL, // No parent @@ -277,6 +251,10 @@ void FirstRunDialog::ShowReportingDialog() { g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseDialogThunk), this); gtk_widget_show_all(dialog_); +#else // !defined(GOOGLE_CHROME_BUILD) + // We don't show the dialog in chromium. Pretend the user accepted. + OnResponseDialog(NULL, GTK_RESPONSE_ACCEPT); +#endif // !defined(GOOGLE_CHROME_BUILD) } void FirstRunDialog::OnTemplateURLModelChanged() { @@ -370,7 +348,7 @@ void FirstRunDialog::OnSearchEngineWindowDestroy(GtkWidget* sender) { search_engine_window_ = NULL; if (chosen_search_engine_) { search_engines_model_->SetDefaultSearchProvider(chosen_search_engine_); - ShowReportingDialog(); + ShowDialog(); } else { FirstRunDone(); } @@ -379,7 +357,7 @@ void FirstRunDialog::OnSearchEngineWindowDestroy(GtkWidget* sender) { void FirstRunDialog::OnResponseDialog(GtkWidget* widget, int response) { if (dialog_) gtk_widget_hide_all(dialog_); - *response_ = response; + response_ = response; // Mark that first run has ran. FirstRun::CreateSentinel(); diff --git a/chrome/browser/gtk/first_run_dialog.h b/chrome/browser/gtk/first_run_dialog.h index 234a64b..fdd47a7 100644 --- a/chrome/browser/gtk/first_run_dialog.h +++ b/chrome/browser/gtk/first_run_dialog.h @@ -25,9 +25,8 @@ class FirstRunDialog : public TemplateURLModelObserver { private: FirstRunDialog(Profile* profile, - bool show_reporting_dialog, - bool show_search_engines_dialog, - int* response); + bool randomize_search_engine_order, + int& response); virtual ~FirstRunDialog(); CHROMEGTK_CALLBACK_1(FirstRunDialog, void, OnResponseDialog, int); @@ -36,7 +35,7 @@ class FirstRunDialog : public TemplateURLModelObserver { CHROMEG_CALLBACK_0(FirstRunDialog, void, OnLearnMoreLinkClicked, GtkButton*); void ShowSearchEngineWindow(); - void ShowReportingDialog(); + void ShowDialog(); // This method closes the first run window and quits the message loop so that // the Chrome startup can continue. This should be called when all the @@ -69,12 +68,8 @@ class FirstRunDialog : public TemplateURLModelObserver { // search engine. TemplateURL* chosen_search_engine_; - // Whether we should show the dialog asking the user whether to report - // crashes and usage stats. - bool show_reporting_dialog_; - // User response (accept or cancel) is returned through this. - int* response_; + int& response_; DISALLOW_COPY_AND_ASSIGN(FirstRunDialog); }; |