Home | History | Annotate | Download | only in gtk
      1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_UI_GTK_FIRST_RUN_DIALOG_H_
      6 #define CHROME_BROWSER_UI_GTK_FIRST_RUN_DIALOG_H_
      7 #pragma once
      8 
      9 typedef struct _GtkButton GtkButton;
     10 typedef struct _GtkWidget GtkWidget;
     11 
     12 #include "chrome/browser/first_run/first_run.h"
     13 #include "chrome/browser/search_engines/template_url_model_observer.h"
     14 #include "ui/base/gtk/gtk_signal.h"
     15 
     16 class TemplateURL;
     17 class TemplateURLModel;
     18 
     19 class FirstRunDialog : public TemplateURLModelObserver {
     20  public:
     21   // Displays the first run UI for reporting opt-in, import data etc.
     22   static bool Show(Profile* profile, bool randomize_search_engine_order);
     23 
     24   virtual void OnTemplateURLModelChanged();
     25 
     26  private:
     27   FirstRunDialog(Profile* profile,
     28                  bool show_reporting_dialog,
     29                  bool show_search_engines_dialog,
     30                  int* response);
     31   virtual ~FirstRunDialog();
     32 
     33   CHROMEGTK_CALLBACK_1(FirstRunDialog, void, OnResponseDialog, int);
     34   CHROMEGTK_CALLBACK_0(FirstRunDialog, void, OnSearchEngineButtonClicked);
     35   CHROMEGTK_CALLBACK_0(FirstRunDialog, void, OnSearchEngineWindowDestroy);
     36   CHROMEG_CALLBACK_0(FirstRunDialog, void, OnLearnMoreLinkClicked, GtkButton*);
     37 
     38   void ShowSearchEngineWindow();
     39   void ShowReportingDialog();
     40 
     41   // This method closes the first run window and quits the message loop so that
     42   // the Chrome startup can continue. This should be called when all the
     43   // first run tasks are done.
     44   void FirstRunDone();
     45 
     46   // The search engine choice window. This is created and shown before
     47   // |dialog_|.
     48   GtkWidget* search_engine_window_;
     49 
     50   // Dialog that holds the bug reporting and default browser checkboxes.
     51   GtkWidget* dialog_;
     52 
     53   // Container for the search engine choices.
     54   GtkWidget* search_engine_hbox_;
     55 
     56   // Crash reporting checkbox
     57   GtkWidget* report_crashes_;
     58 
     59   // Make browser default checkbox
     60   GtkWidget* make_default_;
     61 
     62   // Our current profile
     63   Profile* profile_;
     64 
     65   // Owned by the profile_.
     66   TemplateURLModel* search_engines_model_;
     67 
     68   // The search engine the user chose, or NULL if the user has not chosen a
     69   // search engine.
     70   TemplateURL* chosen_search_engine_;
     71 
     72   // Whether we should show the dialog asking the user whether to report
     73   // crashes and usage stats.
     74   bool show_reporting_dialog_;
     75 
     76   // User response (accept or cancel) is returned through this.
     77   int* response_;
     78 
     79   DISALLOW_COPY_AND_ASSIGN(FirstRunDialog);
     80 };
     81 
     82 #endif  // CHROME_BROWSER_UI_GTK_FIRST_RUN_DIALOG_H_
     83