| 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/first_run_search_engine_view.h" | 5 #include "chrome/browser/ui/views/first_run_search_engine_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 namespace first_run { | 54 namespace first_run { |
| 55 | 55 |
| 56 void ShowFirstRunDialog(Profile* profile, | 56 void ShowFirstRunDialog(Profile* profile, |
| 57 bool randomize_search_engine_experiment) { | 57 bool randomize_search_engine_experiment) { |
| 58 // If the default search is managed via policy, we don't ask the user to | 58 // If the default search is managed via policy, we don't ask the user to |
| 59 // choose. | 59 // choose. |
| 60 TemplateURLService* model = TemplateURLServiceFactory::GetForProfile(profile); | 60 TemplateURLService* model = TemplateURLServiceFactory::GetForProfile(profile); |
| 61 if (!FirstRun::ShouldShowSearchEngineSelector(model)) | 61 if (!first_run::ShouldShowSearchEngineSelector(model)) |
| 62 return; | 62 return; |
| 63 | 63 |
| 64 views::Widget* window = views::Widget::CreateWindow( | 64 views::Widget* window = views::Widget::CreateWindow( |
| 65 new FirstRunSearchEngineView( | 65 new FirstRunSearchEngineView( |
| 66 profile, randomize_search_engine_experiment)); | 66 profile, randomize_search_engine_experiment)); |
| 67 window->SetAlwaysOnTop(true); | 67 window->SetAlwaysOnTop(true); |
| 68 window->Show(); | 68 window->Show(); |
| 69 views::AcceleratorHandler accelerator_handler; | 69 views::AcceleratorHandler accelerator_handler; |
| 70 MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler); | 70 MessageLoopForUI::current()->RunWithDispatcher(&accelerator_handler); |
| 71 } | 71 } |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 } | 501 } |
| 502 | 502 |
| 503 void FirstRunSearchEngineView::ChooseSearchEngine(SearchEngineChoice* choice) { | 503 void FirstRunSearchEngineView::ChooseSearchEngine(SearchEngineChoice* choice) { |
| 504 user_chosen_engine_ = true; | 504 user_chosen_engine_ = true; |
| 505 DCHECK(choice && template_url_service_); | 505 DCHECK(choice && template_url_service_); |
| 506 template_url_service_->SetSearchEngineDialogSlot(choice->slot()); | 506 template_url_service_->SetSearchEngineDialogSlot(choice->slot()); |
| 507 const TemplateURL* default_search = choice->GetSearchEngine(); | 507 const TemplateURL* default_search = choice->GetSearchEngine(); |
| 508 if (default_search) | 508 if (default_search) |
| 509 template_url_service_->SetDefaultSearchProvider(default_search); | 509 template_url_service_->SetDefaultSearchProvider(default_search); |
| 510 } | 510 } |
| OLD | NEW |