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

Side by Side Diff: chrome/browser/ui/webui/settings/search_engines_handler.cc

Issue 2086763002: Don't use deprecated ListValue::Append(Value*) overload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/settings/search_engines_handler.h" 5 #include "chrome/browser/ui/webui/settings/search_engines_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 void SearchEnginesHandler::OnItemsAdded(int start, int length) { 150 void SearchEnginesHandler::OnItemsAdded(int start, int length) {
151 OnModelChanged(); 151 OnModelChanged();
152 } 152 }
153 153
154 void SearchEnginesHandler::OnItemsRemoved(int start, int length) { 154 void SearchEnginesHandler::OnItemsRemoved(int start, int length) {
155 OnModelChanged(); 155 OnModelChanged();
156 } 156 }
157 157
158 base::DictionaryValue* SearchEnginesHandler::CreateDictionaryForEngine( 158 std::unique_ptr<base::DictionaryValue>
159 int index, 159 SearchEnginesHandler::CreateDictionaryForEngine(int index, bool is_default) {
160 bool is_default) {
161 TemplateURLTableModel* table_model = list_controller_.table_model(); 160 TemplateURLTableModel* table_model = list_controller_.table_model();
162 const TemplateURL* template_url = list_controller_.GetTemplateURL(index); 161 const TemplateURL* template_url = list_controller_.GetTemplateURL(index);
163 162
164 // The items which are to be written into |dict| are also described in 163 // The items which are to be written into |dict| are also described in
165 // chrome/browser/resources/settings/search_engines_page/ 164 // chrome/browser/resources/settings/search_engines_page/
166 // in @typedef for SearchEngine. Please update it whenever you add or remove 165 // in @typedef for SearchEngine. Please update it whenever you add or remove
167 // any keys here. 166 // any keys here.
168 base::DictionaryValue* dict = new base::DictionaryValue(); 167 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
169 dict->SetString("name", template_url->short_name()); 168 dict->SetString("name", template_url->short_name());
170 dict->SetString("displayName", 169 dict->SetString("displayName",
171 table_model->GetText( 170 table_model->GetText(
172 index, IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN)); 171 index, IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN));
173 dict->SetString( 172 dict->SetString(
174 "keyword", 173 "keyword",
175 table_model->GetText(index, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN)); 174 table_model->GetText(index, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN));
176 dict->SetString("url", 175 dict->SetString("url",
177 template_url->url_ref().DisplayURL( 176 template_url->url_ref().DisplayURL(
178 UIThreadSearchTermsData(Profile::FromWebUI(web_ui())))); 177 UIThreadSearchTermsData(Profile::FromWebUI(web_ui()))));
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 std::string extension_id; 344 std::string extension_id;
346 CHECK(args->GetString(0, &extension_id)); 345 CHECK(args->GetString(0, &extension_id));
347 ExtensionService* extension_service = 346 ExtensionService* extension_service =
348 extensions::ExtensionSystem::Get(profile_)->extension_service(); 347 extensions::ExtensionSystem::Get(profile_)->extension_service();
349 DCHECK(extension_service); 348 DCHECK(extension_service);
350 extension_service->DisableExtension( 349 extension_service->DisableExtension(
351 extension_id, extensions::Extension::DISABLE_USER_ACTION); 350 extension_id, extensions::Extension::DISABLE_USER_ACTION);
352 } 351 }
353 352
354 } // namespace settings 353 } // namespace settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698