OLD | NEW |
1 // Copyright (c) 2011 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/ui/webui/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 376 |
377 SaveStartupPagesPref(); | 377 SaveStartupPagesPref(); |
378 } | 378 } |
379 | 379 |
380 void BrowserOptionsHandler::AddStartupPage(const ListValue* args) { | 380 void BrowserOptionsHandler::AddStartupPage(const ListValue* args) { |
381 std::string url_string; | 381 std::string url_string; |
382 CHECK_EQ(args->GetSize(), 1U); | 382 CHECK_EQ(args->GetSize(), 1U); |
383 CHECK(args->GetString(0, &url_string)); | 383 CHECK(args->GetString(0, &url_string)); |
384 | 384 |
385 GURL url = URLFixerUpper::FixupURL(url_string, std::string()); | 385 GURL url = URLFixerUpper::FixupURL(url_string, std::string()); |
| 386 if (!url.is_valid()) |
| 387 return; |
386 int index = startup_custom_pages_table_model_->RowCount(); | 388 int index = startup_custom_pages_table_model_->RowCount(); |
387 startup_custom_pages_table_model_->Add(index, url); | 389 startup_custom_pages_table_model_->Add(index, url); |
388 SaveStartupPagesPref(); | 390 SaveStartupPagesPref(); |
389 } | 391 } |
390 | 392 |
391 void BrowserOptionsHandler::EditStartupPage(const ListValue* args) { | 393 void BrowserOptionsHandler::EditStartupPage(const ListValue* args) { |
392 std::string url_string; | 394 std::string url_string; |
393 std::string index_string; | 395 std::string index_string; |
394 int index; | 396 int index; |
395 CHECK_EQ(args->GetSize(), 2U); | 397 CHECK_EQ(args->GetSize(), 2U); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 DictionaryValue* entry = new DictionaryValue(); | 482 DictionaryValue* entry = new DictionaryValue(); |
481 entry->SetString("title", match.description); | 483 entry->SetString("title", match.description); |
482 entry->SetString("displayURL", match.contents); | 484 entry->SetString("displayURL", match.contents); |
483 entry->SetString("url", match.destination_url.spec()); | 485 entry->SetString("url", match.destination_url.spec()); |
484 suggestions.Append(entry); | 486 suggestions.Append(entry); |
485 } | 487 } |
486 | 488 |
487 web_ui_->CallJavascriptFunction( | 489 web_ui_->CallJavascriptFunction( |
488 "BrowserOptions.updateAutocompleteSuggestions", suggestions); | 490 "BrowserOptions.updateAutocompleteSuggestions", suggestions); |
489 } | 491 } |
OLD | NEW |