OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webui/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/app_window.h" | 10 #include "apps/app_window.h" |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 int selected_index = -1; | 1108 int selected_index = -1; |
1109 if (!ExtractIntegerValue(args, &selected_index)) { | 1109 if (!ExtractIntegerValue(args, &selected_index)) { |
1110 NOTREACHED(); | 1110 NOTREACHED(); |
1111 return; | 1111 return; |
1112 } | 1112 } |
1113 | 1113 |
1114 TemplateURLService::TemplateURLVector model_urls( | 1114 TemplateURLService::TemplateURLVector model_urls( |
1115 template_url_service_->GetTemplateURLs()); | 1115 template_url_service_->GetTemplateURLs()); |
1116 if (selected_index >= 0 && | 1116 if (selected_index >= 0 && |
1117 selected_index < static_cast<int>(model_urls.size())) | 1117 selected_index < static_cast<int>(model_urls.size())) |
1118 template_url_service_->SetDefaultSearchProvider(model_urls[selected_index]); | 1118 template_url_service_->SetUserSelectedDefaultSearchProvider( |
| 1119 model_urls[selected_index]); |
1119 | 1120 |
1120 content::RecordAction(UserMetricsAction("Options_SearchEngineChanged")); | 1121 content::RecordAction(UserMetricsAction("Options_SearchEngineChanged")); |
1121 } | 1122 } |
1122 | 1123 |
1123 void BrowserOptionsHandler::AddTemplateUrlServiceObserver() { | 1124 void BrowserOptionsHandler::AddTemplateUrlServiceObserver() { |
1124 template_url_service_ = | 1125 template_url_service_ = |
1125 TemplateURLServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())); | 1126 TemplateURLServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())); |
1126 if (template_url_service_) { | 1127 if (template_url_service_) { |
1127 template_url_service_->Load(); | 1128 template_url_service_->Load(); |
1128 template_url_service_->AddObserver(this); | 1129 template_url_service_->AddObserver(this); |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 extension_name = base::StringValue( | 1747 extension_name = base::StringValue( |
1747 extension ? extension->name() : std::string()); | 1748 extension ? extension->name() : std::string()); |
1748 web_ui()->CallJavascriptFunction( | 1749 web_ui()->CallJavascriptFunction( |
1749 "BrowserOptions.toggleStartupPagesControlled", | 1750 "BrowserOptions.toggleStartupPagesControlled", |
1750 extension_id, | 1751 extension_id, |
1751 extension_name); | 1752 extension_name); |
1752 } | 1753 } |
1753 #endif // defined(OS_WIN) | 1754 #endif // defined(OS_WIN) |
1754 | 1755 |
1755 } // namespace options | 1756 } // namespace options |
OLD | NEW |