Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 2487633003: Change behaivor to decide whether a search engine should be shown in the default list (Closed)
Patch Set: Update based on Peter and Nicolas's comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 return; 1237 return;
1238 1238
1239 const TemplateURL* default_url = 1239 const TemplateURL* default_url =
1240 template_url_service_->GetDefaultSearchProvider(); 1240 template_url_service_->GetDefaultSearchProvider();
1241 1241
1242 int default_index = -1; 1242 int default_index = -1;
1243 base::ListValue search_engines; 1243 base::ListValue search_engines;
1244 TemplateURLService::TemplateURLVector model_urls( 1244 TemplateURLService::TemplateURLVector model_urls(
1245 template_url_service_->GetTemplateURLs()); 1245 template_url_service_->GetTemplateURLs());
1246 for (size_t i = 0; i < model_urls.size(); ++i) { 1246 for (size_t i = 0; i < model_urls.size(); ++i) {
1247 if (!model_urls[i]->ShowInDefaultList( 1247 TemplateURL* t_url = model_urls[i];
1248 template_url_service_->search_terms_data())) 1248 if (!template_url_service_->ShowInDefaultList(t_url))
1249 continue; 1249 continue;
1250 1250
1251 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); 1251 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
1252 entry->SetString("name", model_urls[i]->short_name()); 1252 entry->SetString("name", t_url->short_name());
1253 entry->SetInteger("index", i); 1253 entry->SetInteger("index", i);
1254 search_engines.Append(std::move(entry)); 1254 search_engines.Append(std::move(entry));
1255 if (model_urls[i] == default_url) 1255 if (t_url == default_url)
1256 default_index = i; 1256 default_index = i;
1257 } 1257 }
1258 1258
1259 web_ui()->CallJavascriptFunctionUnsafe( 1259 web_ui()->CallJavascriptFunctionUnsafe(
1260 "BrowserOptions.updateSearchEngines", search_engines, 1260 "BrowserOptions.updateSearchEngines", search_engines,
1261 base::FundamentalValue(default_index), 1261 base::FundamentalValue(default_index),
1262 base::FundamentalValue( 1262 base::FundamentalValue(
1263 template_url_service_->is_default_search_managed() || 1263 template_url_service_->is_default_search_managed() ||
1264 template_url_service_->IsExtensionControlledDefaultSearch())); 1264 template_url_service_->IsExtensionControlledDefaultSearch()));
1265 1265
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 2229
2230 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2230 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2231 #if defined(OS_CHROMEOS) 2231 #if defined(OS_CHROMEOS)
2232 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2232 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2233 #else 2233 #else
2234 return true; 2234 return true;
2235 #endif 2235 #endif
2236 } 2236 }
2237 2237
2238 } // namespace options 2238 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/search_engines/template_url_table_model.cc ('k') | components/search_engines/default_search_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698