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" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // displayed. | 164 // displayed. |
165 TemplateURL* set_as_default = proposed_turl_.get(); | 165 TemplateURL* set_as_default = proposed_turl_.get(); |
166 if (!template_url_service_->CanMakeDefault(set_as_default)) | 166 if (!template_url_service_->CanMakeDefault(set_as_default)) |
167 return true; | 167 return true; |
168 | 168 |
169 template_url_service_->Add(proposed_turl_.release()); | 169 template_url_service_->Add(proposed_turl_.release()); |
170 template_url_service_->SetDefaultSearchProvider(set_as_default); | 170 template_url_service_->SetDefaultSearchProvider(set_as_default); |
171 return true; | 171 return true; |
172 } | 172 } |
173 | 173 |
| 174 views::Widget* DefaultSearchView::GetWidget() { |
| 175 return View::GetWidget(); |
| 176 } |
| 177 |
| 178 const views::Widget* DefaultSearchView::GetWidget() const { |
| 179 return View::GetWidget(); |
| 180 } |
| 181 |
174 DefaultSearchView::DefaultSearchView(TabContents* tab_contents, | 182 DefaultSearchView::DefaultSearchView(TabContents* tab_contents, |
175 TemplateURL* proposed_default_turl, | 183 TemplateURL* proposed_default_turl, |
176 TemplateURLService* template_url_service) | 184 TemplateURLService* template_url_service) |
177 : background_image_(NULL), | 185 : background_image_(NULL), |
178 default_provider_button_(NULL), | 186 default_provider_button_(NULL), |
179 proposed_provider_button_(NULL), | 187 proposed_provider_button_(NULL), |
180 proposed_turl_(proposed_default_turl), | 188 proposed_turl_(proposed_default_turl), |
181 template_url_service_(template_url_service) { | 189 template_url_service_(template_url_service) { |
182 PrefService* prefs = tab_contents->profile()->GetPrefs(); | 190 PrefService* prefs = tab_contents->profile()->GetPrefs(); |
183 SetupControls(prefs); | 191 SetupControls(prefs); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 this, | 301 this, |
294 IDS_DEFAULT_SEARCH_PROMPT_CURRENT, | 302 IDS_DEFAULT_SEARCH_PROMPT_CURRENT, |
295 default_short_name); | 303 default_short_name); |
296 layout->AddView(default_provider_button_); | 304 layout->AddView(default_provider_button_); |
297 proposed_provider_button_ = CreateProviderChoiceButton( | 305 proposed_provider_button_ = CreateProviderChoiceButton( |
298 this, | 306 this, |
299 IDS_DEFAULT_SEARCH_PROMPT_PROPOSED, | 307 IDS_DEFAULT_SEARCH_PROMPT_PROPOSED, |
300 proposed_short_name); | 308 proposed_short_name); |
301 layout->AddView(proposed_provider_button_); | 309 layout->AddView(proposed_provider_button_); |
302 } | 310 } |
OLD | NEW |