OLD | NEW |
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/options2/search_engine_manager_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/search_engine_manager_handler2.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 edit_controller_.reset(new EditSearchEngineController( | 258 edit_controller_.reset(new EditSearchEngineController( |
259 (index == -1) ? NULL : list_controller_->GetTemplateURL(index), this, | 259 (index == -1) ? NULL : list_controller_->GetTemplateURL(index), this, |
260 Profile::FromWebUI(web_ui()))); | 260 Profile::FromWebUI(web_ui()))); |
261 } | 261 } |
262 | 262 |
263 void SearchEngineManagerHandler::OnEditedKeyword( | 263 void SearchEngineManagerHandler::OnEditedKeyword( |
264 const TemplateURL* template_url, | 264 const TemplateURL* template_url, |
265 const string16& title, | 265 const string16& title, |
266 const string16& keyword, | 266 const string16& keyword, |
267 const std::string& url) { | 267 const std::string& url) { |
| 268 DCHECK(!url.empty()); |
268 if (template_url) | 269 if (template_url) |
269 list_controller_->ModifyTemplateURL(template_url, title, keyword, url); | 270 list_controller_->ModifyTemplateURL(template_url, title, keyword, url); |
270 else | 271 else |
271 list_controller_->AddTemplateURL(title, keyword, url); | 272 list_controller_->AddTemplateURL(title, keyword, url); |
272 edit_controller_.reset(); | 273 edit_controller_.reset(); |
273 } | 274 } |
274 | 275 |
275 void SearchEngineManagerHandler::CheckSearchEngineInfoValidity( | 276 void SearchEngineManagerHandler::CheckSearchEngineInfoValidity( |
276 const ListValue* args) | 277 const ListValue* args) |
277 { | 278 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 if (!args->GetString(ENGINE_NAME, &name) || | 315 if (!args->GetString(ENGINE_NAME, &name) || |
315 !args->GetString(ENGINE_KEYWORD, &keyword) || | 316 !args->GetString(ENGINE_KEYWORD, &keyword) || |
316 !args->GetString(ENGINE_URL, &url)) { | 317 !args->GetString(ENGINE_URL, &url)) { |
317 NOTREACHED(); | 318 NOTREACHED(); |
318 return; | 319 return; |
319 } | 320 } |
320 edit_controller_->AcceptAddOrEdit(name, keyword, url); | 321 edit_controller_->AcceptAddOrEdit(name, keyword, url); |
321 } | 322 } |
322 | 323 |
323 } // namespace options2 | 324 } // namespace options2 |
OLD | NEW |