OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/ui/views/default_search_view.h" | 5 #include "chrome/browser/ui/views/default_search_view.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/search_engines/template_url.h" | 11 #include "chrome/browser/search_engines/template_url.h" |
12 #include "chrome/browser/search_engines/template_url_service.h" | 12 #include "chrome/browser/search_engines/template_url_service.h" |
13 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 13 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
14 #include "chrome/browser/ui/views/constrained_window_views.h" | 15 #include "chrome/browser/ui/views/constrained_window_views.h" |
15 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/browser/tab_contents/tab_contents.h" |
16 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
17 #include "grit/locale_settings.h" | 18 #include "grit/locale_settings.h" |
18 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
19 #include "ui/base/message_box_flags.h" | 20 #include "ui/base/message_box_flags.h" |
20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
21 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
22 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
23 #include "views/controls/button/text_button.h" | 24 #include "views/controls/button/text_button.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 default_provider_button_(NULL), | 188 default_provider_button_(NULL), |
188 proposed_provider_button_(NULL), | 189 proposed_provider_button_(NULL), |
189 proposed_turl_(proposed_default_turl), | 190 proposed_turl_(proposed_default_turl), |
190 template_url_service_(template_url_service) { | 191 template_url_service_(template_url_service) { |
191 Profile* profile = | 192 Profile* profile = |
192 Profile::FromBrowserContext(tab_contents->browser_context()); | 193 Profile::FromBrowserContext(tab_contents->browser_context()); |
193 PrefService* prefs = profile->GetPrefs(); | 194 PrefService* prefs = profile->GetPrefs(); |
194 SetupControls(prefs); | 195 SetupControls(prefs); |
195 | 196 |
196 // Show the dialog. | 197 // Show the dialog. |
197 new ConstrainedWindowViews(tab_contents, this); | 198 TabContentsWrapper* wrapper = |
| 199 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| 200 new ConstrainedWindowViews(wrapper, this); |
198 } | 201 } |
199 | 202 |
200 void DefaultSearchView::SetupControls(PrefService* prefs) { | 203 void DefaultSearchView::SetupControls(PrefService* prefs) { |
201 using views::ColumnSet; | 204 using views::ColumnSet; |
202 using views::GridLayout; | 205 using views::GridLayout; |
203 using views::ImageView; | 206 using views::ImageView; |
204 using views::Label; | 207 using views::Label; |
205 | 208 |
206 // Column set id's. | 209 // Column set id's. |
207 const int kWholeDialogViewSetId = 0; | 210 const int kWholeDialogViewSetId = 0; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 this, | 307 this, |
305 IDS_DEFAULT_SEARCH_PROMPT_CURRENT, | 308 IDS_DEFAULT_SEARCH_PROMPT_CURRENT, |
306 default_short_name); | 309 default_short_name); |
307 layout->AddView(default_provider_button_); | 310 layout->AddView(default_provider_button_); |
308 proposed_provider_button_ = CreateProviderChoiceButton( | 311 proposed_provider_button_ = CreateProviderChoiceButton( |
309 this, | 312 this, |
310 IDS_DEFAULT_SEARCH_PROMPT_PROPOSED, | 313 IDS_DEFAULT_SEARCH_PROMPT_PROPOSED, |
311 proposed_short_name); | 314 proposed_short_name); |
312 layout->AddView(proposed_provider_button_); | 315 layout->AddView(proposed_provider_button_); |
313 } | 316 } |
OLD | NEW |