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

Side by Side Diff: chrome/browser/dom_ui/options/search_engine_manager_handler.cc

Issue 6044007: Remove wstring from TableModel.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 12 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/dom_ui/options/search_engine_manager_handler.h" 5 #include "chrome/browser/dom_ui/options/search_engine_manager_handler.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 void SearchEngineManagerHandler::OnItemsRemoved(int start, int length) { 150 void SearchEngineManagerHandler::OnItemsRemoved(int start, int length) {
151 OnModelChanged(); 151 OnModelChanged();
152 } 152 }
153 153
154 DictionaryValue* SearchEngineManagerHandler::CreateDictionaryForHeading( 154 DictionaryValue* SearchEngineManagerHandler::CreateDictionaryForHeading(
155 int group_index) { 155 int group_index) {
156 TableModel::Groups groups = list_controller_->table_model()->GetGroups(); 156 TableModel::Groups groups = list_controller_->table_model()->GetGroups();
157 157
158 DictionaryValue* dict = new DictionaryValue(); 158 DictionaryValue* dict = new DictionaryValue();
159 dict->SetString("heading", WideToUTF16Hack(groups[group_index].title)); 159 dict->SetString("heading", groups[group_index].title);
160 return dict; 160 return dict;
161 } 161 }
162 162
163 DictionaryValue* SearchEngineManagerHandler::CreateDictionaryForEngine( 163 DictionaryValue* SearchEngineManagerHandler::CreateDictionaryForEngine(
164 int index, bool is_default) { 164 int index, bool is_default) {
165 TemplateURLTableModel* table_model = list_controller_->table_model(); 165 TemplateURLTableModel* table_model = list_controller_->table_model();
166 166
167 DictionaryValue* dict = new DictionaryValue(); 167 DictionaryValue* dict = new DictionaryValue();
168 dict->SetString("name", WideToUTF16Hack(table_model->GetText( 168 dict->SetString("name", table_model->GetText(
169 index, IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN))); 169 index, IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN));
170 dict->SetString("keyword", WideToUTF16Hack(table_model->GetText( 170 dict->SetString("keyword", table_model->GetText(
171 index, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN))); 171 index, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN));
172 const TemplateURL* template_url = list_controller_->GetTemplateURL(index); 172 const TemplateURL* template_url = list_controller_->GetTemplateURL(index);
173 GURL icon_url = template_url->GetFavIconURL(); 173 GURL icon_url = template_url->GetFavIconURL();
174 if (icon_url.is_valid()) 174 if (icon_url.is_valid())
175 dict->SetString("iconURL", icon_url.spec()); 175 dict->SetString("iconURL", icon_url.spec());
176 dict->SetString("modelIndex", base::IntToString(index)); 176 dict->SetString("modelIndex", base::IntToString(index));
177 177
178 if (list_controller_->CanRemove(template_url)) 178 if (list_controller_->CanRemove(template_url))
179 dict->SetString("canBeRemoved", "1"); 179 dict->SetString("canBeRemoved", "1");
180 if (list_controller_->CanMakeDefault(template_url)) 180 if (list_controller_->CanMakeDefault(template_url))
181 dict->SetString("canBeDefault", "1"); 181 dict->SetString("canBeDefault", "1");
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 string16 keyword; 288 string16 keyword;
289 std::string url; 289 std::string url;
290 if (!args->GetString(ENGINE_NAME, &name) || 290 if (!args->GetString(ENGINE_NAME, &name) ||
291 !args->GetString(ENGINE_KEYWORD, &keyword) || 291 !args->GetString(ENGINE_KEYWORD, &keyword) ||
292 !args->GetString(ENGINE_URL, &url)) { 292 !args->GetString(ENGINE_URL, &url)) {
293 NOTREACHED(); 293 NOTREACHED();
294 return; 294 return;
295 } 295 }
296 edit_controller_->AcceptAddOrEdit(name, keyword, url); 296 edit_controller_->AcceptAddOrEdit(name, keyword, url);
297 } 297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698