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/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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 !args->GetString(ENGINE_URL, &url) || | 289 !args->GetString(ENGINE_URL, &url) || |
290 !args->GetString(3, &modelIndex)) { | 290 !args->GetString(3, &modelIndex)) { |
291 NOTREACHED(); | 291 NOTREACHED(); |
292 return; | 292 return; |
293 } | 293 } |
294 | 294 |
295 base::DictionaryValue validity; | 295 base::DictionaryValue validity; |
296 validity.SetBoolean("name", edit_controller_->IsTitleValid(name)); | 296 validity.SetBoolean("name", edit_controller_->IsTitleValid(name)); |
297 validity.SetBoolean("keyword", edit_controller_->IsKeywordValid(keyword)); | 297 validity.SetBoolean("keyword", edit_controller_->IsKeywordValid(keyword)); |
298 validity.SetBoolean("url", edit_controller_->IsURLValid(url)); | 298 validity.SetBoolean("url", edit_controller_->IsURLValid(url)); |
299 base::StringValue indexValue(modelIndex); | 299 base::Value indexValue(modelIndex); |
300 web_ui()->CallJavascriptFunctionUnsafe( | 300 web_ui()->CallJavascriptFunctionUnsafe( |
301 "SearchEngineManager.validityCheckCallback", validity, indexValue); | 301 "SearchEngineManager.validityCheckCallback", validity, indexValue); |
302 } | 302 } |
303 | 303 |
304 void SearchEngineManagerHandler::EditCancelled(const base::ListValue* args) { | 304 void SearchEngineManagerHandler::EditCancelled(const base::ListValue* args) { |
305 if (!edit_controller_.get()) | 305 if (!edit_controller_.get()) |
306 return; | 306 return; |
307 edit_controller_->CleanUpCancelledAdd(); | 307 edit_controller_->CleanUpCancelledAdd(); |
308 edit_controller_.reset(); | 308 edit_controller_.reset(); |
309 } | 309 } |
(...skipping 13 matching lines...) Expand all Loading... |
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 |
OLD | NEW |