diff options
3 files changed, 5 insertions, 1 deletions
diff --git a/chrome/browser/resources/options/manage_profile_overlay.html b/chrome/browser/resources/options/manage_profile_overlay.html index 6b5950a..3a5eb85 100644 --- a/chrome/browser/resources/options/manage_profile_overlay.html +++ b/chrome/browser/resources/options/manage_profile_overlay.html @@ -13,7 +13,7 @@ <span id="manage-profile-name-label" for="manage-profile-name" i18n-content="manageProfilesNameLabel"> </span> - <input id="manage-profile-name" type="text" required> + <input id="manage-profile-name" type="text" pattern=".*\S.*" required> </label> </div> <div id="manage-profile-error-bubble" hidden></div> diff --git a/chrome/browser/ui/webui/options/create_profile_handler.cc b/chrome/browser/ui/webui/options/create_profile_handler.cc index d7c88a6..8d722e7 100644 --- a/chrome/browser/ui/webui/options/create_profile_handler.cc +++ b/chrome/browser/ui/webui/options/create_profile_handler.cc @@ -8,6 +8,7 @@ #include "base/files/file_path.h" #include "base/metrics/histogram.h" #include "base/prefs/pref_service.h" +#include "base/strings/string_util.h" #include "base/value_conversions.h" #include "base/values.h" #include "chrome/browser/browser_process.h" @@ -80,6 +81,7 @@ void CreateProfileHandler::CreateProfile(const base::ListValue* args) { bool create_shortcut = false; bool supervised_user = false; if (args->GetString(0, &name) && args->GetString(1, &icon)) { + base::TrimWhitespace(name, base::TRIM_ALL, &name); if (args->GetBoolean(2, &create_shortcut)) { bool success = args->GetBoolean(3, &supervised_user); DCHECK(success); diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc index 41689f8..9bbce88 100644 --- a/chrome/browser/ui/webui/options/manage_profile_handler.cc +++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc @@ -9,6 +9,7 @@ #include "base/prefs/pref_service.h" #include "base/prefs/scoped_user_pref_update.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/value_conversions.h" #include "base/values.h" @@ -381,6 +382,7 @@ void ManageProfileHandler::SetProfileIconAndName(const base::ListValue* args) { if (!args->GetString(2, &new_profile_name)) return; + base::TrimWhitespace(new_profile_name, base::TRIM_ALL, &new_profile_name); profiles::UpdateProfileName(profile, new_profile_name); } |