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