| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_GTK_FIRST_RUN_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_GTK_FIRST_RUN_DIALOG_H_ |
| 6 #define CHROME_BROWSER_GTK_FIRST_RUN_DIALOG_H_ | 6 #define CHROME_BROWSER_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 "app/gtk_signal.h" | 12 #include "app/gtk_signal.h" |
| 13 #include "chrome/browser/first_run/first_run.h" | 13 #include "chrome/browser/first_run/first_run.h" |
| 14 #include "chrome/browser/importer/importer.h" | 14 #include "chrome/browser/importer/importer.h" |
| 15 #include "chrome/browser/search_engines/template_url_model.h" |
| 15 | 16 |
| 16 class FirstRunDialog : public ImportObserver { | 17 class FirstRunDialog : public ImporterHost::Observer, |
| 18 public TemplateURLModelObserver { |
| 17 public: | 19 public: |
| 18 // Displays the first run UI for reporting opt-in, import data etc. | 20 // Displays the first run UI for reporting opt-in, import data etc. |
| 19 static bool Show(Profile* profile, ProcessSingleton* process_singleton); | 21 static bool Show(Profile* profile, ProcessSingleton* process_singleton); |
| 20 | 22 |
| 21 // Overridden from ImportObserver: | 23 // Overridden from ImporterHost::Observer ------------------------------------ |
| 22 virtual void ImportCanceled() { | 24 virtual void ImportEnded(); |
| 23 FirstRunDone(); | 25 virtual void ImportStarted() {} |
| 24 } | 26 virtual void ImportItemStarted(importer::ImportItem item) {} |
| 25 virtual void ImportComplete() { | 27 virtual void ImportItemEnded(importer::ImportItem item) {} |
| 26 FirstRunDone(); | 28 |
| 27 } | 29 virtual void OnTemplateURLModelChanged(); |
| 28 | 30 |
| 29 private: | 31 private: |
| 30 FirstRunDialog(Profile* profile, int& response); | 32 FirstRunDialog(Profile* profile, int& response); |
| 31 ~FirstRunDialog() {} | 33 virtual ~FirstRunDialog(); |
| 32 | 34 |
| 33 CHROMEGTK_CALLBACK_1(FirstRunDialog, void, OnResponseDialog, int); | 35 CHROMEGTK_CALLBACK_1(FirstRunDialog, void, OnResponseDialog, int); |
| 36 CHROMEGTK_CALLBACK_0(FirstRunDialog, void, OnSearchEngineButtonClicked); |
| 37 CHROMEGTK_CALLBACK_0(FirstRunDialog, void, OnSearchEngineWindowDestroy); |
| 34 CHROMEG_CALLBACK_0(FirstRunDialog, void, OnLearnMoreLinkClicked, GtkButton*); | 38 CHROMEG_CALLBACK_0(FirstRunDialog, void, OnLearnMoreLinkClicked, GtkButton*); |
| 35 | 39 |
| 40 void ShowSearchEngineWindow(); |
| 41 void ShowDialog(); |
| 42 |
| 36 // This method closes the first run window and quits the message loop so that | 43 // This method closes the first run window and quits the message loop so that |
| 37 // the Chrome startup can continue. This should be called when all the | 44 // the Chrome startup can continue. This should be called when all the |
| 38 // first run tasks are done. | 45 // first run tasks are done. |
| 39 void FirstRunDone(); | 46 void FirstRunDone(); |
| 40 | 47 |
| 41 // First Run UI Dialog | 48 // The search engine choice window. This is created and shown before |
| 49 // |dialog_|. |
| 50 GtkWidget* search_engine_window_; |
| 51 |
| 52 // Dialog that holds the bug reporting and default browser checkboxes. |
| 42 GtkWidget* dialog_; | 53 GtkWidget* dialog_; |
| 43 | 54 |
| 55 // Container for the search engine choices. |
| 56 GtkWidget* search_engine_hbox_; |
| 57 |
| 44 // Crash reporting checkbox | 58 // Crash reporting checkbox |
| 45 GtkWidget* report_crashes_; | 59 GtkWidget* report_crashes_; |
| 46 | 60 |
| 47 // Make browser default checkbox | 61 // Make browser default checkbox |
| 48 GtkWidget* make_default_; | 62 GtkWidget* make_default_; |
| 49 | 63 |
| 50 // Import data checkbox | |
| 51 GtkWidget* import_data_; | |
| 52 | |
| 53 // Combo box that displays list of profiles from which we can import. | |
| 54 GtkWidget* import_profile_; | |
| 55 | |
| 56 // Our current profile | 64 // Our current profile |
| 57 Profile* profile_; | 65 Profile* profile_; |
| 58 | 66 |
| 67 // Owned by the profile_. |
| 68 TemplateURLModel* search_engines_model_; |
| 69 |
| 70 // The search engine the user chose, or NULL if the user has not chosen a |
| 71 // search engine. |
| 72 TemplateURL* chosen_search_engine_; |
| 73 |
| 59 // User response (accept or cancel) is returned through this. | 74 // User response (accept or cancel) is returned through this. |
| 60 int& response_; | 75 int& response_; |
| 61 | 76 |
| 62 // Utility class that does the actual import. | 77 // Utility class that does the actual import. |
| 63 scoped_refptr<ImporterHost> importer_host_; | 78 scoped_refptr<ImporterHost> importer_host_; |
| 64 | 79 |
| 65 DISALLOW_COPY_AND_ASSIGN(FirstRunDialog); | 80 DISALLOW_COPY_AND_ASSIGN(FirstRunDialog); |
| 66 }; | 81 }; |
| 67 | 82 |
| 68 #endif // CHROME_BROWSER_GTK_FIRST_RUN_DIALOG_H_ | 83 #endif // CHROME_BROWSER_GTK_FIRST_RUN_DIALOG_H_ |
| OLD | NEW |