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 // Invalid urls should not be added to the list. http://crbug.com/100658. | |
387 if (url.spec().empty()) | |
csilv
2011/10/19 18:49:48
I think url.is_valid() would be a better choice he
rosen.dash
2011/10/20 06:31:25
Done.
| |
388 return; | |
386 int index = startup_custom_pages_table_model_->RowCount(); | 389 int index = startup_custom_pages_table_model_->RowCount(); |
387 startup_custom_pages_table_model_->Add(index, url); | 390 startup_custom_pages_table_model_->Add(index, url); |
388 SaveStartupPagesPref(); | 391 SaveStartupPagesPref(); |
389 } | 392 } |
390 | 393 |
391 void BrowserOptionsHandler::EditStartupPage(const ListValue* args) { | 394 void BrowserOptionsHandler::EditStartupPage(const ListValue* args) { |
392 std::string url_string; | 395 std::string url_string; |
393 std::string index_string; | 396 std::string index_string; |
394 int index; | 397 int index; |
395 CHECK_EQ(args->GetSize(), 2U); | 398 CHECK_EQ(args->GetSize(), 2U); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 DictionaryValue* entry = new DictionaryValue(); | 483 DictionaryValue* entry = new DictionaryValue(); |
481 entry->SetString("title", match.description); | 484 entry->SetString("title", match.description); |
482 entry->SetString("displayURL", match.contents); | 485 entry->SetString("displayURL", match.contents); |
483 entry->SetString("url", match.destination_url.spec()); | 486 entry->SetString("url", match.destination_url.spec()); |
484 suggestions.Append(entry); | 487 suggestions.Append(entry); |
485 } | 488 } |
486 | 489 |
487 web_ui_->CallJavascriptFunction( | 490 web_ui_->CallJavascriptFunction( |
488 "BrowserOptions.updateAutocompleteSuggestions", suggestions); | 491 "BrowserOptions.updateAutocompleteSuggestions", suggestions); |
489 } | 492 } |
OLD | NEW |