| 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_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ |
| 6 #define CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ | 6 #define CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "chrome/browser/views/keyword_editor_view.h" | 10 #include "chrome/browser/search_engines/template_url_model.h" |
| 11 #include "gfx/size.h" | 11 #include "gfx/size.h" |
| 12 #include "views/controls/button/native_button.h" | 12 #include "views/controls/button/native_button.h" |
| 13 #include "views/view.h" | 13 #include "views/view.h" |
| 14 #include "views/window/window_delegate.h" | 14 #include "views/window/window_delegate.h" |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 class ButtonListener; | 17 class ButtonListener; |
| 18 class ImageView; | 18 class ImageView; |
| 19 class Label; | 19 class Label; |
| 20 class Separator; | 20 class Separator; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 // Data for the search engine held here. | 67 // Data for the search engine held here. |
| 68 const TemplateURL* search_engine_; | 68 const TemplateURL* search_engine_; |
| 69 | 69 |
| 70 // Used for UX testing. Gives slot in which search engine was shown. | 70 // Used for UX testing. Gives slot in which search engine was shown. |
| 71 int slot_; | 71 int slot_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(SearchEngineChoice); | 73 DISALLOW_COPY_AND_ASSIGN(SearchEngineChoice); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 // This class receives a callback when the search engine dialog closes. | |
| 77 class SearchEngineSelectionObserver { | |
| 78 public: | |
| 79 virtual ~SearchEngineSelectionObserver() {} | |
| 80 // Called when the user has chosen a search engine. | |
| 81 virtual void SearchEngineChosen(const TemplateURL* default_search) = 0; | |
| 82 }; | |
| 83 | |
| 84 // This class displays a large search engine choice dialog view during | 76 // This class displays a large search engine choice dialog view during |
| 85 // initial first run import. | 77 // initial first run import. |
| 86 class FirstRunSearchEngineView | 78 class FirstRunSearchEngineView |
| 87 : public views::View, | 79 : public views::View, |
| 88 public views::ButtonListener, | 80 public views::ButtonListener, |
| 89 public views::WindowDelegate, | 81 public views::WindowDelegate, |
| 90 public TemplateURLModelObserver { | 82 public TemplateURLModelObserver { |
| 91 public: | 83 public: |
| 92 // |observer| is the FirstRunView that waits for us to pass back a search | 84 // |profile| allows us to get the set of imported search engines. |
| 93 // engine choice. | |
| 94 // |profile| allows us to get the set of imported search engines, and | |
| 95 // display the KeywordEditorView on demand. | |
| 96 // |randomize| is true if logos are to be displayed in random order. | 85 // |randomize| is true if logos are to be displayed in random order. |
| 97 FirstRunSearchEngineView(SearchEngineSelectionObserver* observer, | 86 FirstRunSearchEngineView(Profile* profile, bool randomize); |
| 98 Profile* profile, bool randomize); | |
| 99 | 87 |
| 100 virtual ~FirstRunSearchEngineView(); | 88 virtual ~FirstRunSearchEngineView(); |
| 101 | 89 |
| 102 // Overridden from views::View: | 90 // Overridden from views::View: |
| 103 virtual gfx::Size GetPreferredSize(); | 91 virtual gfx::Size GetPreferredSize(); |
| 104 virtual void Layout(); | 92 virtual void Layout(); |
| 105 | 93 |
| 106 // Overridden from views::WindowDelegate: | 94 // Overridden from views::WindowDelegate: |
| 107 virtual std::wstring GetWindowTitle() const; | 95 virtual std::wstring GetWindowTitle() const; |
| 108 views::View* GetContentsView() { return this; } | 96 views::View* GetContentsView() { return this; } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 128 | 116 |
| 129 // One for each search engine choice offered, either three or four. | 117 // One for each search engine choice offered, either three or four. |
| 130 std::vector<SearchEngineChoice*> search_engine_choices_; | 118 std::vector<SearchEngineChoice*> search_engine_choices_; |
| 131 | 119 |
| 132 // If logos are to be displayed in random order. Used for UX testing. | 120 // If logos are to be displayed in random order. Used for UX testing. |
| 133 bool randomize_; | 121 bool randomize_; |
| 134 | 122 |
| 135 // The profile associated with this import process. | 123 // The profile associated with this import process. |
| 136 Profile* profile_; | 124 Profile* profile_; |
| 137 | 125 |
| 138 // Gets called back when one of the choice buttons is pressed. | |
| 139 SearchEngineSelectionObserver* observer_; | |
| 140 | |
| 141 bool text_direction_is_rtl_; | 126 bool text_direction_is_rtl_; |
| 142 | 127 |
| 143 // Image of browser search box with grey background and bubble arrow. | 128 // Image of browser search box with grey background and bubble arrow. |
| 144 views::ImageView* background_image_; | 129 views::ImageView* background_image_; |
| 145 | 130 |
| 146 // UI elements: | 131 // UI elements: |
| 147 views::Label* title_label_; | 132 views::Label* title_label_; |
| 148 views::Label* text_label_; | 133 views::Label* text_label_; |
| 149 | 134 |
| 150 DISALLOW_COPY_AND_ASSIGN(FirstRunSearchEngineView); | 135 DISALLOW_COPY_AND_ASSIGN(FirstRunSearchEngineView); |
| 151 }; | 136 }; |
| 152 | 137 |
| 153 #endif // CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ | 138 #endif // CHROME_BROWSER_VIEWS_FIRST_RUN_SEARCH_ENGINE_VIEW_H_ |
| 154 | 139 |
| OLD | NEW |