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

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

Issue 2347973002: Enable Chrome to tweak search engines for some locales (Closed)
Patch Set: final nits Created 4 years, 2 months 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/search_engine_manager_handler.h" 5 #include "chrome/browser/ui/webui/options/search_engine_manager_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 if (icon_url.is_valid()) 190 if (icon_url.is_valid())
191 dict->SetString("iconURL", icon_url.spec()); 191 dict->SetString("iconURL", icon_url.spec());
192 dict->SetString("modelIndex", base::IntToString(index)); 192 dict->SetString("modelIndex", base::IntToString(index));
193 193
194 dict->SetBoolean("canBeRemoved", 194 dict->SetBoolean("canBeRemoved",
195 list_controller_->CanRemove(template_url)); 195 list_controller_->CanRemove(template_url));
196 dict->SetBoolean("canBeDefault", 196 dict->SetBoolean("canBeDefault",
197 list_controller_->CanMakeDefault(template_url)); 197 list_controller_->CanMakeDefault(template_url));
198 dict->SetBoolean("default", is_default); 198 dict->SetBoolean("default", is_default);
199 dict->SetBoolean("canBeEdited", list_controller_->CanEdit(template_url)); 199 dict->SetBoolean("canBeEdited", list_controller_->CanEdit(template_url));
200 TemplateURL::Type type = template_url->GetType(); 200 TemplateURL::Type type = template_url->type();
201 dict->SetBoolean("isOmniboxExtension", 201 dict->SetBoolean("isOmniboxExtension",
202 type == TemplateURL::OMNIBOX_API_EXTENSION); 202 type == TemplateURL::OMNIBOX_API_EXTENSION);
203 if (type == TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION || 203 if (type == TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION ||
204 type == TemplateURL::OMNIBOX_API_EXTENSION) { 204 type == TemplateURL::OMNIBOX_API_EXTENSION) {
205 const extensions::Extension* extension = 205 const extensions::Extension* extension =
206 extensions::ExtensionRegistry::Get(Profile::FromWebUI(web_ui())) 206 extensions::ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))
207 ->GetExtensionById(template_url->GetExtensionId(), 207 ->GetExtensionById(template_url->GetExtensionId(),
208 extensions::ExtensionRegistry::EVERYTHING); 208 extensions::ExtensionRegistry::EVERYTHING);
209 if (extension) { 209 if (extension) {
210 dict->Set("extension", 210 dict->Set("extension",
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 // Recheck validity. It's possible to get here with invalid input if e.g. the 324 // Recheck validity. It's possible to get here with invalid input if e.g. the
325 // user calls the right JS functions directly from the web inspector. 325 // user calls the right JS functions directly from the web inspector.
326 if (edit_controller_->IsTitleValid(name) && 326 if (edit_controller_->IsTitleValid(name) &&
327 edit_controller_->IsKeywordValid(keyword) && 327 edit_controller_->IsKeywordValid(keyword) &&
328 edit_controller_->IsURLValid(url)) 328 edit_controller_->IsURLValid(url))
329 edit_controller_->AcceptAddOrEdit(name, keyword, url); 329 edit_controller_->AcceptAddOrEdit(name, keyword, url);
330 } 330 }
331 331
332 } // namespace options 332 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698