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

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: 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];
Peter Kasting 2016/11/10 06:41:06 Nit: If you're going to declare this, use it every
ltian 2016/11/11 03:52:13 Done.
1248 if (!template_url_service_->ShowInDefaultList(t_url) ||
1249 !model_urls[i]->SupportsReplacement(
Peter Kasting 2016/11/10 06:41:06 I'm concerned that I don't understand why this was
ltian 2016/11/11 03:52:13 If I understand correctly, browser_options_handler
1248 template_url_service_->search_terms_data())) 1250 template_url_service_->search_terms_data()))
1249 continue; 1251 continue;
1250 1252
1251 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue()); 1253 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
1252 entry->SetString("name", model_urls[i]->short_name()); 1254 entry->SetString("name", model_urls[i]->short_name());
1253 entry->SetInteger("index", i); 1255 entry->SetInteger("index", i);
1254 search_engines.Append(std::move(entry)); 1256 search_engines.Append(std::move(entry));
1255 if (model_urls[i] == default_url) 1257 if (model_urls[i] == default_url)
1256 default_index = i; 1258 default_index = i;
1257 } 1259 }
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 2231
2230 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2232 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2231 #if defined(OS_CHROMEOS) 2233 #if defined(OS_CHROMEOS)
2232 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2234 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2233 #else 2235 #else
2234 return true; 2236 return true;
2235 #endif 2237 #endif
2236 } 2238 }
2237 2239
2238 } // namespace options 2240 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698