Index: chrome/browser/ui/views/first_run_search_engine_view.h |
=================================================================== |
--- chrome/browser/ui/views/first_run_search_engine_view.h (revision 111086) |
+++ chrome/browser/ui/views/first_run_search_engine_view.h (working copy) |
@@ -87,6 +87,7 @@ |
// Overridden from views::WidgetDelegateView: |
virtual string16 GetWindowTitle() const OVERRIDE; |
virtual views::View* GetContentsView() OVERRIDE { return this; } |
+ virtual void WindowClosing() OVERRIDE; |
// Overridden from views::ButtonListener: |
virtual void ButtonPressed(views::Button* sender, |
@@ -108,11 +109,20 @@ |
// to present to the user. |
virtual void OnTemplateURLServiceChanged() OVERRIDE; |
+#if defined(UNIT_TEST) |
+ void set_quit_on_closing(bool quit_on_closing) { |
+ quit_on_closing_ = quit_on_closing; |
+ } |
+#endif |
+ |
private: |
// Once the TemplateURLService has loaded and we're in a View hierarchy, it's |
// OK to add the search engines from the TemplateURLService. |
void AddSearchEnginesIfPossible(); |
+ // Sets the default search engine to the one represented by |choice|. |
+ void ChooseSearchEngine(SearchEngineChoice* choice); |
+ |
// One for each search engine choice offered, either three or four. |
std::vector<SearchEngineChoice*> search_engine_choices_; |
@@ -125,7 +135,6 @@ |
bool text_direction_is_rtl_; |
- bool template_url_service_loaded_; |
bool added_to_view_hierarchy_; |
// Image of browser search box with grey background and bubble arrow. |
@@ -135,6 +144,22 @@ |
views::Label* title_label_; |
views::Label* text_label_; |
+ // True when the user has chosen a particular search engine. Defaults to |
+ // false. When the user closes the window without choosing a search engine, |
+ // the engine specified by |fallback_choice_| is chosen. |
+ bool user_chosen_engine_; |
+ |
+ // The engine to choose when the user closes the window without explicitly |
+ // making a selection. Because of randomization functionality, we cannot |
+ // reliably deduce this from slot order, so this value is saved prior to |
+ // randomization. |
+ SearchEngineChoice* fallback_choice_; |
+ |
+ // Defaults to true. Indicates that the current message loop should be quit |
+ // when the window is closed. This is false in tests when this dialog does not |
+ // spin its own message loop. |
+ bool quit_on_closing_; |
+ |
DISALLOW_COPY_AND_ASSIGN(FirstRunSearchEngineView); |
}; |