OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
11 #include "base/values.h" | 11 #include "base/values.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 DictionaryValue* SearchEngineManagerHandler::CreateDictionaryForEngine( | 151 DictionaryValue* SearchEngineManagerHandler::CreateDictionaryForEngine( |
152 int index, bool is_default) { | 152 int index, bool is_default) { |
153 TemplateURLTableModel* table_model = list_controller_->table_model(); | 153 TemplateURLTableModel* table_model = list_controller_->table_model(); |
154 | 154 |
155 DictionaryValue* dict = new DictionaryValue(); | 155 DictionaryValue* dict = new DictionaryValue(); |
156 dict->SetString("name", table_model->GetText( | 156 dict->SetString("name", table_model->GetText( |
157 index, IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN)); | 157 index, IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN)); |
158 dict->SetString("keyword", table_model->GetText( | 158 dict->SetString("keyword", table_model->GetText( |
159 index, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN)); | 159 index, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN)); |
160 const TemplateURL* template_url = list_controller_->GetTemplateURL(index); | 160 const TemplateURL* template_url = list_controller_->GetTemplateURL(index); |
161 dict->SetString("url", WideToUTF16Hack(template_url->url()->DisplayURL())); | 161 dict->SetString("url", template_url->url()->DisplayURL()); |
162 dict->SetBoolean("urlLocked", template_url->prepopulate_id() > 0); | 162 dict->SetBoolean("urlLocked", template_url->prepopulate_id() > 0); |
163 GURL icon_url = template_url->GetFavIconURL(); | 163 GURL icon_url = template_url->GetFavIconURL(); |
164 if (icon_url.is_valid()) | 164 if (icon_url.is_valid()) |
165 dict->SetString("iconURL", icon_url.spec()); | 165 dict->SetString("iconURL", icon_url.spec()); |
166 dict->SetString("modelIndex", base::IntToString(index)); | 166 dict->SetString("modelIndex", base::IntToString(index)); |
167 | 167 |
168 if (list_controller_->CanRemove(template_url)) | 168 if (list_controller_->CanRemove(template_url)) |
169 dict->SetString("canBeRemoved", "1"); | 169 dict->SetString("canBeRemoved", "1"); |
170 if (list_controller_->CanMakeDefault(template_url)) | 170 if (list_controller_->CanMakeDefault(template_url)) |
171 dict->SetString("canBeDefault", "1"); | 171 dict->SetString("canBeDefault", "1"); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 string16 keyword; | 270 string16 keyword; |
271 std::string url; | 271 std::string url; |
272 if (!args->GetString(ENGINE_NAME, &name) || | 272 if (!args->GetString(ENGINE_NAME, &name) || |
273 !args->GetString(ENGINE_KEYWORD, &keyword) || | 273 !args->GetString(ENGINE_KEYWORD, &keyword) || |
274 !args->GetString(ENGINE_URL, &url)) { | 274 !args->GetString(ENGINE_URL, &url)) { |
275 NOTREACHED(); | 275 NOTREACHED(); |
276 return; | 276 return; |
277 } | 277 } |
278 edit_controller_->AcceptAddOrEdit(name, keyword, url); | 278 edit_controller_->AcceptAddOrEdit(name, keyword, url); |
279 } | 279 } |
OLD | NEW |