summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-02 16:46:42 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-02 16:46:42 +0000
commitb28e5dbc0b1b7b1b23279e1347ca2299f09a7330 (patch)
treef3f3ea8ad6db347f8c83751340894ee1b0e106f7 /chrome
parent51a0be2384cb761f097fa6e3b4fa202fc3a6f5eb (diff)
downloadchromium_src-b28e5dbc0b1b7b1b23279e1347ca2299f09a7330.zip
chromium_src-b28e5dbc0b1b7b1b23279e1347ca2299f09a7330.tar.gz
chromium_src-b28e5dbc0b1b7b1b23279e1347ca2299f09a7330.tar.bz2
Change HTTP Basic Auth messaging to be resistent to long realm strings, and to clarify that the realm portion of the message is coming from a remote server.
BUG=79426 TEST=none Review URL: http://codereview.chromium.org/6905140 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd2
-rw-r--r--chrome/browser/ui/login/login_prompt.cc8
2 files changed, 8 insertions, 2 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index cd4c110..a9ea038 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -3375,7 +3375,7 @@ Other platform defines such as use_titlecase are declared in build/common.gypi.
Authentication Required
</message>
<message name="IDS_LOGIN_DIALOG_DESCRIPTION" desc="String to be displayed in the login prompt dialog to explain what the user needs to do">
- The server <ph name="DOMAIN">$1<ex>google.com</ex></ph> at <ph name="REALM">$2<ex>site name</ex></ph> requires a username and password.
+ The server <ph name="DOMAIN">$1<ex>google.com</ex></ph> requires a username and password. The server says: <ph name="REALM">$2<ex>opaque string</ex></ph>.
</message>
<message name="IDS_LOGIN_DIALOG_DESCRIPTION_NO_REALM" desc="String to be displayed in the login prompt dialog to explain what the user needs to do">
The server <ph name="DOMAIN">$1<ex>google.com</ex></ph> requires a username and password.
diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc
index 2a28022..d34673f 100644
--- a/chrome/browser/ui/login/login_prompt.cc
+++ b/chrome/browser/ui/login/login_prompt.cc
@@ -26,6 +26,7 @@
#include "net/base/net_util.h"
#include "net/url_request/url_request.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/text/text_elider.h"
using webkit_glue::PasswordForm;
@@ -414,7 +415,12 @@ class LoginDialogTask : public Task {
handler_->SetPasswordManager(password_manager);
string16 host_and_port_hack16 = WideToUTF16Hack(auth_info_->host_and_port);
- string16 realm_hack16 = WideToUTF16Hack(auth_info_->realm);
+
+ // The realm is controlled by the remote server, so there is no reason
+ // to believe it is of a reasonable length.
+ string16 realm_hack16;
+ ui::ElideString(WideToUTF16Hack(auth_info_->realm), 120, &realm_hack16);
+
string16 explanation = realm_hack16.empty() ?
l10n_util::GetStringFUTF16(IDS_LOGIN_DIALOG_DESCRIPTION_NO_REALM,
host_and_port_hack16) :