Chromium Code Reviews| 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..25ac290a75e7c87daf90b2059821269bfe2f2270 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 url; |
|
dpapad
2016/03/31 20:34:08
Nit: s/url/fixed_url, for consistency with EditSta
Dan Beam
2016/03/31 22:04:40
Done.
|
| + if (!settings_utils::FixupAndValidateStartupPage(url_string, &url)) |
| return; |
| int row_count = startup_custom_pages_table_model_->RowCount(); |
| @@ -179,20 +180,20 @@ void StartupPagesHandler::AddStartupPage(const base::ListValue* args) { |
| } |
| 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); |