summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordpolukhin@chromium.org <dpolukhin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-02 19:20:48 +0000
committerdpolukhin@chromium.org <dpolukhin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-02 19:20:48 +0000
commit5970e76db0fecf73cccb67253ae5276ab7eb4937 (patch)
tree4f850b0be0e3b8c4c0d282912b1d89998968a313
parent74c66a6f8e7ee4730885cc79c88d64ba2fc3cb3d (diff)
downloadchromium_src-5970e76db0fecf73cccb67253ae5276ab7eb4937.zip
chromium_src-5970e76db0fecf73cccb67253ae5276ab7eb4937.tar.gz
chromium_src-5970e76db0fecf73cccb67253ae5276ab7eb4937.tar.bz2
Polish new user login screen:
- create new account should looks like link - removed username and password labels, they should be visible as background text in input fields if user hasn't typed anything yet. BUG=none TEST=Create new account should be link on Chromium OS login screen. Review URL: http://codereview.chromium.org/1593005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43508 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd6
-rw-r--r--chrome/browser/chromeos/login/login_manager_view.cc52
-rw-r--r--chrome/browser/chromeos/login/login_manager_view.h9
3 files changed, 29 insertions, 38 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index fa62815..050d5a7 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -7210,16 +7210,16 @@ Keep your key file in a safe place. You will need it to create new versions of y
Sign in with your Google account
</message>
<message name="IDS_LOGIN_USERNAME">
- Username:
+ Email
</message>
<message name="IDS_LOGIN_PASSWORD">
- Password:
+ Password
</message>
<message name="IDS_LOGIN_BUTTON">
Sign in
</message>
<message name="IDS_CREATE_ACCOUNT_BUTTON">
- Create an account
+ Create a Google Account now
</message>
<message name="IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME">
Date and Time
diff --git a/chrome/browser/chromeos/login/login_manager_view.cc b/chrome/browser/chromeos/login/login_manager_view.cc
index c3c3be1..183d642 100644
--- a/chrome/browser/chromeos/login/login_manager_view.cc
+++ b/chrome/browser/chromeos/login/login_manager_view.cc
@@ -66,11 +66,9 @@ LoginManagerView::LoginManagerView(ScreenObserver* observer)
password_field_(NULL),
os_version_label_(NULL),
title_label_(NULL),
- username_label_(NULL),
- password_label_(NULL),
error_label_(NULL),
sign_in_button_(NULL),
- create_account_button_(NULL),
+ create_account_link_(NULL),
accel_focus_user_(views::Accelerator(base::VKEY_U, false, false, true)),
accel_focus_pass_(views::Accelerator(base::VKEY_P, false, false, true)),
observer_(observer),
@@ -106,22 +104,10 @@ void LoginManagerView::Init() {
title_label_->SetFont(title_font);
AddChildView(title_label_);
- username_label_ = new views::Label();
- username_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- username_label_->SetColor(kLabelColor);
- username_label_->SetFont(label_font);
- AddChildView(username_label_);
-
username_field_ = new views::Textfield;
username_field_->SetFont(field_font);
AddChildView(username_field_);
- password_label_ = new views::Label();
- password_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- password_label_->SetColor(kLabelColor);
- password_label_->SetFont(label_font);
- AddChildView(password_label_);
-
password_field_ = new views::Textfield(views::Textfield::STYLE_PASSWORD);
password_field_->SetFont(field_font);
AddChildView(password_field_);
@@ -130,9 +116,10 @@ void LoginManagerView::Init() {
sign_in_button_->set_font(button_font);
AddChildView(sign_in_button_);
- create_account_button_ = new views::NativeButton(this, std::wstring());
- create_account_button_->set_font(button_font);
- AddChildView(create_account_button_);
+ create_account_link_ = new views::Link(std::wstring());
+ create_account_link_->SetController(this);
+ create_account_link_->SetFont(label_font);
+ AddChildView(create_account_link_);
os_version_label_ = new views::Label();
os_version_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
@@ -189,10 +176,12 @@ bool LoginManagerView::AcceleratorPressed(
void LoginManagerView::UpdateLocalizedStrings() {
title_label_->SetText(l10n_util::GetString(IDS_LOGIN_TITLE));
- username_label_->SetText(l10n_util::GetString(IDS_LOGIN_USERNAME));
- password_label_->SetText(l10n_util::GetString(IDS_LOGIN_PASSWORD));
+ username_field_->set_text_to_display_when_empty(
+ l10n_util::GetStringUTF16(IDS_LOGIN_USERNAME));
+ password_field_->set_text_to_display_when_empty(
+ l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD));
sign_in_button_->SetLabel(l10n_util::GetString(IDS_LOGIN_BUTTON));
- create_account_button_->SetLabel(
+ create_account_link_->SetText(
l10n_util::GetString(IDS_CREATE_ACCOUNT_BUTTON));
ShowError(error_id_);
}
@@ -260,14 +249,11 @@ void LoginManagerView::Layout() {
int max_width = width() - (x + kVersionPad);
y += (setViewBounds(title_label_, x, y, max_width, false) + kRowPad);
- y += (setViewBounds(username_label_, x, y, max_width, false) + kLabelPad);
y += (setViewBounds(username_field_, x, y, kTextfieldWidth, true) + kRowPad);
- y += (setViewBounds(password_label_, x, y, max_width, false) + kLabelPad);
y += (setViewBounds(password_field_, x, y, kTextfieldWidth, true) + kRowPad);
- y += kRowPad + std::max(
- setViewBounds(sign_in_button_, x, y, kTextfieldWidth / 2, false),
- setViewBounds(create_account_button_,
- x + kTextfieldWidth / 2, y, kTextfieldWidth / 2, false));
+ y += (setViewBounds(sign_in_button_, x, y, kTextfieldWidth, false) + kRowPad);
+ y += setViewBounds(create_account_link_, x, y, kTextfieldWidth, false);
+ y += kRowPad;
int padding = BorderDefinition::kScreenBorder.shadow +
BorderDefinition::kScreenBorder.corner_radius / 2;
@@ -326,11 +312,13 @@ void LoginManagerView::Login() {
// Sign in button causes a login attempt.
void LoginManagerView::ButtonPressed(
views::Button* sender, const views::Event& event) {
- if (sender == sign_in_button_) {
- Login();
- } else if (observer_) {
- observer_->OnExit(ScreenObserver::LOGIN_CREATE_ACCOUNT);
- }
+ DCHECK(sender == sign_in_button_);
+ Login();
+}
+
+void LoginManagerView::LinkActivated(views::Link* source, int event_flags) {
+ DCHECK(source == create_account_link_);
+ observer_->OnExit(ScreenObserver::LOGIN_CREATE_ACCOUNT);
}
void LoginManagerView::OnLoginFailure(const std::string error) {
diff --git a/chrome/browser/chromeos/login/login_manager_view.h b/chrome/browser/chromeos/login/login_manager_view.h
index 53082fd..17f9a1b 100644
--- a/chrome/browser/chromeos/login/login_manager_view.h
+++ b/chrome/browser/chromeos/login/login_manager_view.h
@@ -14,6 +14,7 @@
#include "chrome/browser/chromeos/version_loader.h"
#include "views/accelerator.h"
#include "views/controls/button/button.h"
+#include "views/controls/link.h"
#include "views/controls/textfield/textfield.h"
#include "views/view.h"
#include "views/widget/widget_gtk.h"
@@ -30,6 +31,7 @@ class ScreenObserver;
class LoginManagerView : public views::View,
public LoginStatusConsumer,
public views::Textfield::Controller,
+ public views::LinkController,
public views::ButtonListener {
public:
explicit LoginManagerView(ScreenObserver* observer);
@@ -68,6 +70,9 @@ class LoginManagerView : public views::View,
// Overriden from views::ButtonListener.
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+ // Overriden from views::LinkController.
+ virtual void LinkActivated(views::Link* source, int event_flags);
+
virtual bool AcceleratorPressed(const views::Accelerator& accelerator);
// Overriden from LoginStatusConsumer.
@@ -105,11 +110,9 @@ class LoginManagerView : public views::View,
views::Textfield* password_field_;
views::Label* os_version_label_;
views::Label* title_label_;
- views::Label* username_label_;
- views::Label* password_label_;
views::Label* error_label_;
views::NativeButton* sign_in_button_;
- views::NativeButton* create_account_button_;
+ views::Link* create_account_link_;
views::Accelerator accel_focus_user_;
views::Accelerator accel_focus_pass_;