| Index: chrome/browser/ui/webui/options/startup_pages_handler.cc
|
| diff --git a/chrome/browser/ui/webui/options/startup_pages_handler.cc b/chrome/browser/ui/webui/options/startup_pages_handler.cc
|
| index cc3d2693e5691d7ebc2857c21beb30018bb15392..44c3a29c1a3ecd5c6fc6d5985a603356fbde2f8f 100644
|
| --- a/chrome/browser/ui/webui/options/startup_pages_handler.cc
|
| +++ b/chrome/browser/ui/webui/options/startup_pages_handler.cc
|
| @@ -16,6 +16,7 @@
|
| #include "chrome/browser/prefs/session_startup_pref.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/search_engines/template_url_service_factory.h"
|
| +#include "chrome/browser/ui/webui/settings_utils.h"
|
| #include "chrome/common/pref_names.h"
|
| #include "chrome/grit/generated_resources.h"
|
| #include "components/metrics/proto/omnibox_event.pb.h"
|
| @@ -24,9 +25,9 @@
|
| #include "components/omnibox/browser/autocomplete_input.h"
|
| #include "components/omnibox/browser/autocomplete_result.h"
|
| #include "components/prefs/pref_service.h"
|
| -#include "components/url_formatter/url_fixer.h"
|
| #include "content/public/browser/notification_details.h"
|
| #include "content/public/browser/web_ui.h"
|
| +#include "url/gurl.h"
|
|
|
| namespace options {
|
|
|
| @@ -166,8 +167,8 @@ void StartupPagesHandler::AddStartupPage(const base::ListValue* args) {
|
| std::string url_string;
|
| CHECK(args->GetString(0, &url_string));
|
|
|
| - GURL url = url_formatter::FixupURL(url_string, std::string());
|
| - if (!url.is_valid())
|
| + GURL fixed_url;
|
| + if (!settings_utils::FixupAndValidateStartupPage(url_string, &fixed_url))
|
| return;
|
|
|
| int row_count = startup_custom_pages_table_model_->RowCount();
|
| @@ -175,24 +176,24 @@ void StartupPagesHandler::AddStartupPage(const base::ListValue* args) {
|
| if (!args->GetInteger(1, &index) || index > row_count)
|
| index = row_count;
|
|
|
| - startup_custom_pages_table_model_->Add(index, url);
|
| + startup_custom_pages_table_model_->Add(index, fixed_url);
|
| }
|
|
|
| void StartupPagesHandler::EditStartupPage(const base::ListValue* args) {
|
| - std::string url_string;
|
| - GURL fixed_url;
|
| - int index;
|
| CHECK_EQ(args->GetSize(), 2U);
|
| + int index;
|
| CHECK(args->GetInteger(0, &index));
|
| - CHECK(args->GetString(1, &url_string));
|
|
|
| if (index < 0 || index > startup_custom_pages_table_model_->RowCount()) {
|
| NOTREACHED();
|
| return;
|
| }
|
|
|
| - fixed_url = url_formatter::FixupURL(url_string, std::string());
|
| - if (!fixed_url.is_empty()) {
|
| + std::string url_string;
|
| + CHECK(args->GetString(1, &url_string));
|
| +
|
| + GURL fixed_url;
|
| + if (settings_utils::FixupAndValidateStartupPage(url_string, &fixed_url)) {
|
| std::vector<GURL> urls = startup_custom_pages_table_model_->GetURLs();
|
| urls[index] = fixed_url;
|
| startup_custom_pages_table_model_->SetURLs(urls);
|
|
|