summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordpolukhin@chromium.org <dpolukhin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-27 08:04:24 +0000
committerdpolukhin@chromium.org <dpolukhin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-27 08:04:24 +0000
commitb0c4d1b323b0d3d543d4654d81082ed4651b3e35 (patch)
tree4a46a3059589990ec8d007d70a2addd6542f3f95
parent406027c015b3be7a30d22d2e521ff4bcf8c492b0 (diff)
downloadchromium_src-b0c4d1b323b0d3d543d4654d81082ed4651b3e35.zip
chromium_src-b0c4d1b323b0d3d543d4654d81082ed4651b3e35.tar.gz
chromium_src-b0c4d1b323b0d3d543d4654d81082ed4651b3e35.tar.bz2
Replace "Go Incognito" with "Guest" pod and "New user" pod replaced with "+" pod.
BUG=http://code.google.com/p/chromium-os/issues/detail?id=5756 TEST=Manual Review URL: http://codereview.chromium.org/3478002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60620 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd14
-rw-r--r--chrome/app/theme/login_add_user.pngbin0 -> 4283 bytes
-rw-r--r--chrome/app/theme/login_default.pngbin1613 -> 8595 bytes
-rw-r--r--chrome/app/theme/login_guest.pngbin0 -> 14567 bytes
-rw-r--r--chrome/app/theme/theme_resources.grd3
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.cc29
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.h5
-rw-r--r--chrome/browser/chromeos/login/existing_user_view.cc2
-rw-r--r--chrome/browser/chromeos/login/helper.h4
-rw-r--r--chrome/browser/chromeos/login/new_user_view.cc45
-rw-r--r--chrome/browser/chromeos/login/new_user_view.h2
-rw-r--r--chrome/browser/chromeos/login/rounded_rect_painter.cc8
-rw-r--r--chrome/browser/chromeos/login/screen_lock_view.cc4
-rw-r--r--chrome/browser/chromeos/login/user_controller.cc167
-rw-r--r--chrome/browser/chromeos/login/user_controller.h24
-rw-r--r--chrome/browser/chromeos/login/user_image_view.cc2
-rw-r--r--chrome/browser/chromeos/login/user_view.cc12
-rw-r--r--chrome/browser/chromeos/login/user_view.h7
18 files changed, 217 insertions, 111 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 90f1e04..0bd2509 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -8304,8 +8304,11 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_NETWORK_SELECTION_ERROR_HELP" desc="Help link that is shown when connection to network failed or timed out.">
Fix network issues
</message>
- <message name="IDS_LOGIN_TITLE">
- Sign in with your Google account
+ <message name="IDS_LOGIN_TITLE" desc="Title of sign in box">
+ Sign in to <ph name="PRODUCT_NAME">$1<ex>Chrome OS</ex></ph>
+ </message>
+ <message name="IDS_LOGIN_TITLE_HINT" desc="Hint under title 'Sign in to Chrome OS'">
+ with your Google Account
</message>
<message name="IDS_LOGIN_USERNAME">
Email
@@ -9581,8 +9584,11 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_NOTIFICATION_PANEL_TITLE" desc="Text for the title of the notification panel.">
Notifications
</message>
- <message name="IDS_GUEST" desc="Shown in login panel for guest user">
- New user
+ <message name="IDS_GUEST" desc="Shown in login panel for users that would like to browse without signin.">
+ Guest
+ </message>
+ <message name="IDS_ADD_USER" desc="Shown in login panel for adding new user to login screen.">
+ Add a user
</message>
<message name="IDS_LANGUAGES_MORE" desc="Main language list 'more' link. Expands all possible languages, not only the main ones.">
More...
diff --git a/chrome/app/theme/login_add_user.png b/chrome/app/theme/login_add_user.png
new file mode 100644
index 0000000..7ac8d36
--- /dev/null
+++ b/chrome/app/theme/login_add_user.png
Binary files differ
diff --git a/chrome/app/theme/login_default.png b/chrome/app/theme/login_default.png
index ae65076..0fa2d7e 100644
--- a/chrome/app/theme/login_default.png
+++ b/chrome/app/theme/login_default.png
Binary files differ
diff --git a/chrome/app/theme/login_guest.png b/chrome/app/theme/login_guest.png
new file mode 100644
index 0000000..9ee7ec2
--- /dev/null
+++ b/chrome/app/theme/login_guest.png
Binary files differ
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index 2d08f82..a2b66bc 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -475,7 +475,8 @@
<include name="IDR_COMPACTNAV_SEPARATOR" file="compactnav_separator.png" type="BINDATA" />
<include name="IDR_INCOGNITO_GUY" file="incognito_guy.png" type="BINDATA" />
<include name="IDR_LOGIN_DEFAULT_USER" file="login_default.png" type="BINDATA" />
- <include name="IDR_LOGIN_OTHER_USER" file="login_other.png" type="BINDATA" />
+ <include name="IDR_LOGIN_GUEST" file="login_guest.png" type="BINDATA" />
+ <include name="IDR_LOGIN_ADD_USER" file="login_add_user.png" type="BINDATA" />
<include name="IDR_NOTIFICATION_LOW_BATTERY" file="notification_battery_low.png" type="BINDATA" />
<include name="IDR_NOTIFICATION_MENU" file="notification_menu.png" type="BINDATA" />
<include name="IDR_NOTIFICATION_NETWORK_FAILED" file="notification_network_failed.png" type="BINDATA" />
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index a96ba36..f3235a5 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -46,7 +46,7 @@ namespace {
// Max number of users we'll show. The true max is the min of this and the
// number of windows that fit on the screen.
-const size_t kMaxUsers = 6;
+const size_t kMaxUsers = 5;
// Used to indicate no user has been selected.
const size_t kNotSelected = -1;
@@ -65,10 +65,12 @@ void EnableTooltipsIfNeeded(const std::vector<UserController*>& controllers) {
controllers[i]->user().GetDisplayName();
++visible_display_names[display_name];
}
- for (size_t i = 0; i + 1 < controllers.size(); ++i) {
+ for (size_t i = 0; i < controllers.size(); ++i) {
const std::string& display_name =
controllers[i]->user().GetDisplayName();
- bool show_tooltip = visible_display_names[display_name] > 1;
+ bool show_tooltip = controllers[i]->is_new_user() ||
+ controllers[i]->is_bwsi() ||
+ visible_display_names[display_name] > 1;
controllers[i]->EnableNameTooltip(show_tooltip);
}
}
@@ -130,8 +132,11 @@ ExistingUserController::ExistingUserController(
}
}
- // Add the view representing the guest user last.
- controllers_.push_back(new UserController(this));
+ if (!controllers_.empty() && UserCrosSettingsProvider::cached_allow_bwsi())
+ controllers_.push_back(new UserController(this, true));
+
+ // Add the view representing the new user.
+ controllers_.push_back(new UserController(this, false));
}
void ExistingUserController::Init() {
@@ -148,17 +153,16 @@ void ExistingUserController::Init() {
if (!WizardController::IsDeviceRegistered()) {
background_view_->SetOobeProgressBarVisible(true);
background_view_->SetOobeProgress(chromeos::BackgroundView::SIGNIN);
- } else {
- background_view_->SetGoIncognitoButtonVisible(
- UserCrosSettingsProvider::cached_allow_bwsi(), this);
}
background_window_->Show();
}
+ // If there's only new user pod, show BWSI link on it.
+ bool show_bwsi_link = controllers_.size() == 1;
for (size_t i = 0; i < controllers_.size(); ++i) {
(controllers_[i])->Init(static_cast<int>(i),
static_cast<int>(controllers_.size()),
- background_view_->IsOobeProgressBarVisible());
+ show_bwsi_link);
}
EnableTooltipsIfNeeded(controllers_);
@@ -182,7 +186,8 @@ void ExistingUserController::LoginNewUser(const std::string& username,
const std::string& password) {
SelectNewUser();
UserController* new_user = controllers_.back();
- if (!new_user->is_guest())
+ DCHECK(new_user->is_new_user());
+ if (!new_user->is_new_user())
return;
NewUserView* new_user_view = new_user->new_user_view();
new_user_view->SetUsername(username);
@@ -407,7 +412,7 @@ void ExistingUserController::OnLoginFailure(const LoginFailure& failure) {
ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error);
}
} else {
- if (controllers_[selected_view_index_]->is_guest())
+ if (controllers_[selected_view_index_]->is_new_user())
ShowError(IDS_LOGIN_ERROR_AUTHENTICATING_NEW, error);
else
ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error);
@@ -446,7 +451,7 @@ void ExistingUserController::ShowError(int error_id,
gfx::Rect bounds = controllers_[selected_view_index_]->GetScreenBounds();
BubbleBorder::ArrowLocation arrow;
- if (controllers_[selected_view_index_]->is_guest()) {
+ if (controllers_[selected_view_index_]->is_new_user()) {
arrow = BubbleBorder::LEFT_TOP;
} else {
// Point info bubble arrow to cursor position (approximately).
diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h
index 95534a5..afec728 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.h
+++ b/chrome/browser/chromeos/login/existing_user_controller.h
@@ -34,9 +34,8 @@ class MessageBubble;
// ExistingUserController is used to handle login when someone has already
// logged into the machine. When Init is invoked a UserController is created for
-// each of the Users's in the UserManager (including one for guest), and the
-// window manager is then told to show the windows. If the user clicks on the
-// guest entry the WizardWindow is swapped in.
+// each of the Users's in the UserManager (including one for new user and
+// one for BWSI login), and the window manager is then told to show the windows.
//
// To use ExistingUserController create an instance of it and invoke Init.
//
diff --git a/chrome/browser/chromeos/login/existing_user_view.cc b/chrome/browser/chromeos/login/existing_user_view.cc
index 423fdfc..ace4426 100644
--- a/chrome/browser/chromeos/login/existing_user_view.cc
+++ b/chrome/browser/chromeos/login/existing_user_view.cc
@@ -48,7 +48,7 @@ class UserEntryTextfield : public views::Textfield {
virtual bool OnKeyPressed(const views::KeyEvent& e) {
if (e.GetKeyCode() == app::VKEY_TAB) {
int index = controller_->user_index() + (e.IsShiftDown() ? -1 : 1);
- controller_->SelectUser(index);
+ controller_->SelectUser(index, false);
return true;
} else {
return false;
diff --git a/chrome/browser/chromeos/login/helper.h b/chrome/browser/chromeos/login/helper.h
index 2716c9c..4e7de2a 100644
--- a/chrome/browser/chromeos/login/helper.h
+++ b/chrome/browser/chromeos/login/helper.h
@@ -68,6 +68,10 @@ const SkColor kTextColor = SK_ColorWHITE;
const int kWizardScreenWidth = 700;
const int kWizardScreenHeight = 416;
+const int kScreenCornerRadius = 10;
+const int kUserCornerRadius = 5;
+
+
} // namespace login
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/new_user_view.cc b/chrome/browser/chromeos/login/new_user_view.cc
index 64607a5..684bc56 100644
--- a/chrome/browser/chromeos/login/new_user_view.cc
+++ b/chrome/browser/chromeos/login/new_user_view.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/rounded_rect_painter.h"
#include "grit/app_resources.h"
+#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "views/controls/button/native_button.h"
#include "views/controls/label.h"
@@ -38,6 +39,7 @@ using views::WidgetGtk;
namespace {
const int kTextfieldWidth = 286;
+const int kSplitterHeight = 1;
const int kRowPad = 7;
const int kColumnPad = 7;
const int kLanguagesMenuHeight = 30;
@@ -76,6 +78,8 @@ NewUserView::NewUserView(Delegate* delegate,
: username_field_(NULL),
password_field_(NULL),
title_label_(NULL),
+ title_hint_label_(NULL),
+ splitter_(NULL),
sign_in_button_(NULL),
create_account_link_(NULL),
browse_without_signin_link_(NULL),
@@ -111,6 +115,7 @@ void NewUserView::Init() {
// Set up fonts.
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
gfx::Font title_font = rb.GetFont(ResourceBundle::MediumBoldFont);
+ gfx::Font title_hint_font = rb.GetFont(ResourceBundle::BoldFont);
title_label_ = new views::Label();
title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
@@ -118,6 +123,18 @@ void NewUserView::Init() {
title_label_->SetMultiLine(true);
AddChildView(title_label_);
+ title_hint_label_ = new views::Label();
+ title_hint_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
+ title_hint_label_->SetFont(title_hint_font);
+ title_hint_label_->SetColor(SK_ColorGRAY);
+ title_hint_label_->SetMultiLine(true);
+ AddChildView(title_hint_label_);
+
+ splitter_ = new views::View();
+ splitter_->set_background(
+ views::Background::CreateSolidBackground(SK_ColorGRAY));
+ AddChildView(splitter_);
+
username_field_ = new UsernameField();
AddChildView(username_field_);
@@ -206,7 +223,9 @@ void NewUserView::AddChildView(View* view) {
}
void NewUserView::UpdateLocalizedStrings() {
- title_label_->SetText(l10n_util::GetString(IDS_LOGIN_TITLE));
+ title_label_->SetText(l10n_util::GetStringF(
+ IDS_LOGIN_TITLE, l10n_util::GetString(IDS_PRODUCT_OS_NAME)));
+ title_hint_label_->SetText(l10n_util::GetString(IDS_LOGIN_TITLE_HINT));
username_field_->set_text_to_display_when_empty(
l10n_util::GetStringUTF16(IDS_LOGIN_USERNAME));
password_field_->set_text_to_display_when_empty(
@@ -302,30 +321,42 @@ void NewUserView::Layout() {
languages_menubutton_->GetPreferredSize().width());
int height = kLanguagesMenuHeight;
languages_menubutton_->SetBounds(x, y, width, height);
+ y += height + kRowPad;
width = std::min(this->width() - insets.width() - 2 * kColumnPad,
kTextfieldWidth);
x = (this->width() - width) / 2;
int max_width = this->width() - x - insets.right();
title_label_->SizeToFit(max_width);
+ title_hint_label_->SizeToFit(max_width);
+ // Top align title and title hint.
+ y += setViewBounds(title_label_, x, y, max_width, false);
+ y += setViewBounds(title_hint_label_, x, y, max_width, false);
+ int title_end = y;
+
+ // Center align all other controls.
int create_account_link_height = need_create_account_ ?
create_account_link_->GetPreferredSize().height() : 0;
int browse_without_signin_link_height = need_browse_without_signin_ ?
browse_without_signin_link_->GetPreferredSize().height() : 0;
- height = title_label_->GetPreferredSize().height() +
- username_field_->GetPreferredSize().height() +
+ height = username_field_->GetPreferredSize().height() +
password_field_->GetPreferredSize().height() +
sign_in_button_->GetPreferredSize().height() +
create_account_link_height +
browse_without_signin_link_height +
- 4 * kRowPad;
- y = (this->height() - height) / 2;
+ 5 * kRowPad;
+ y += (this->height() - y - height) / 2;
+
+ int corner_radius = need_border_ ? login::kScreenCornerRadius : 0;
+ splitter_->SetBounds(insets.left() - corner_radius / 2,
+ title_end + (y - title_end) / 2,
+ this->width() - insets.width() + corner_radius,
+ kSplitterHeight);
- y += (setViewBounds(title_label_, x, y, max_width, false) + kRowPad);
y += (setViewBounds(username_field_, x, y, width, true) + kRowPad);
- y += (setViewBounds(password_field_, x, y, width, true) + kRowPad);
+ y += (setViewBounds(password_field_, x, y, width, true) + 3 * kRowPad);
int throbber_y = y;
y += (setViewBounds(sign_in_button_.get(), x, y, width, false) + kRowPad);
setViewBounds(throbber_,
diff --git a/chrome/browser/chromeos/login/new_user_view.h b/chrome/browser/chromeos/login/new_user_view.h
index d9b88ff..dfc1ad5 100644
--- a/chrome/browser/chromeos/login/new_user_view.h
+++ b/chrome/browser/chromeos/login/new_user_view.h
@@ -141,6 +141,8 @@ class NewUserView : public views::View,
views::Textfield* username_field_;
views::Textfield* password_field_;
views::Label* title_label_;
+ views::Label* title_hint_label_;
+ views::View* splitter_;
scoped_ptr<views::NativeButton> sign_in_button_;
views::Link* create_account_link_;
views::Link* browse_without_signin_link_;
diff --git a/chrome/browser/chromeos/login/rounded_rect_painter.cc b/chrome/browser/chromeos/login/rounded_rect_painter.cc
index 8a65070..a4878e5 100644
--- a/chrome/browser/chromeos/login/rounded_rect_painter.cc
+++ b/chrome/browser/chromeos/login/rounded_rect_painter.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "gfx/canvas_skia.h"
+#include "chrome/browser/chromeos/login/helper.h"
#include "third_party/skia/include/effects/SkBlurMaskFilter.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "views/border.h"
@@ -15,9 +16,6 @@ namespace chromeos {
namespace {
-const int kScreenCornerRadius = 10;
-const int kUserCornerRadius = 5;
-
const SkColor kScreenTopColor = SkColorSetRGB(250, 251, 251);
const SkColor kScreenBottomColor = SkColorSetRGB(204, 209, 212);
const SkColor kScreenShadowColor = SkColorSetARGB(64, 34, 54, 115);
@@ -233,7 +231,7 @@ const BorderDefinition BorderDefinition::kScreenBorder = {
SK_ColorBLACK,
kScreenShadow,
kScreenShadowColor,
- kScreenCornerRadius,
+ login::kScreenCornerRadius,
kScreenTopColor,
kScreenBottomColor
};
@@ -243,7 +241,7 @@ const BorderDefinition BorderDefinition::kUserBorder = {
SK_ColorBLACK,
0,
kScreenShadowColor,
- kUserCornerRadius,
+ login::kUserCornerRadius,
kScreenTopColor,
kScreenBottomColor
};
diff --git a/chrome/browser/chromeos/login/screen_lock_view.cc b/chrome/browser/chromeos/login/screen_lock_view.cc
index dcb0f08..b1dbd3a 100644
--- a/chrome/browser/chromeos/login/screen_lock_view.cc
+++ b/chrome/browser/chromeos/login/screen_lock_view.cc
@@ -67,7 +67,9 @@ void ScreenLockView::Init() {
NotificationType::LOGIN_USER_IMAGE_CHANGED,
NotificationService::AllSources());
- user_view_ = new UserView(this, false);
+ user_view_ = new UserView(this,
+ false, // is_login
+ true); // need_background
views::View* main = new views::View();
// Use rounded rect background.
views::Painter* painter =
diff --git a/chrome/browser/chromeos/login/user_controller.cc b/chrome/browser/chromeos/login/user_controller.cc
index 4288c31..e86a972 100644
--- a/chrome/browser/chromeos/login/user_controller.cc
+++ b/chrome/browser/chromeos/login/user_controller.cc
@@ -26,6 +26,7 @@
#include "views/controls/button/native_button.h"
#include "views/controls/label.h"
#include "views/grid_layout.h"
+#include "views/screen.h"
#include "views/widget/root_view.h"
#include "views/widget/widget_gtk.h"
@@ -57,7 +58,7 @@ class ClickNotifyingWidget : public views::WidgetGtk {
private:
gboolean OnButtonPress(GtkWidget* widget, GdkEventButton* event) {
if (!controller_->is_user_selected())
- controller_->SelectUser(controller_->user_index());
+ controller_->SelectUser(controller_->user_index(), true);
return views::WidgetGtk::OnButtonPress(widget, event);
}
@@ -67,24 +68,6 @@ class ClickNotifyingWidget : public views::WidgetGtk {
DISALLOW_COPY_AND_ASSIGN(ClickNotifyingWidget);
};
-// Returns tooltip text for user name. Tooltip contains user's display name
-// and his email domain to distinguish this user from the other one with the
-// same display name.
-std::string GetNameTooltip(const UserManager::User& user) {
- const std::string& email = user.email();
- size_t at_pos = email.rfind('@');
- if (at_pos == std::string::npos) {
- NOTREACHED();
- return std::string();
- }
- size_t domain_start = at_pos + 1;
- std::string domain = email.substr(domain_start,
- email.length() - domain_start);
- return base::StringPrintf("%s (%s)",
- user.GetDisplayName().c_str(),
- domain.c_str());
-}
-
} // namespace
using login::kBackgroundColor;
@@ -98,10 +81,11 @@ const int UserController::kPadding = 20;
// Max size needed when an entry is not selected.
const int UserController::kUnselectedSize = 100;
-UserController::UserController(Delegate* delegate)
+UserController::UserController(Delegate* delegate, bool is_bwsi)
: user_index_(-1),
is_user_selected_(false),
- is_guest_(true),
+ is_new_user_(!is_bwsi),
+ is_bwsi_(is_bwsi),
show_name_tooltip_(false),
delegate_(delegate),
controls_window_(NULL),
@@ -124,7 +108,8 @@ UserController::UserController(Delegate* delegate,
const UserManager::User& user)
: user_index_(-1),
is_user_selected_(false),
- is_guest_(false),
+ is_new_user_(false),
+ is_bwsi_(false),
show_name_tooltip_(false),
user_(user),
delegate_(delegate),
@@ -166,14 +151,36 @@ void UserController::Init(int index,
}
void UserController::SetPasswordEnabled(bool enable) {
- DCHECK(!is_guest_);
+ DCHECK(!is_new_user_);
existing_user_view_->password_field()->SetEnabled(enable);
existing_user_view_->submit_button()->SetEnabled(enable);
enable ? user_view_->StopThrobber() : user_view_->StartThrobber();
}
+std::wstring UserController::GetNameTooltip() const {
+ if (is_new_user_)
+ return l10n_util::GetString(IDS_ADD_USER);
+ if (is_bwsi_)
+ return l10n_util::GetString(IDS_GO_INCOGNITO_BUTTON);
+
+ // Tooltip contains user's display name and his email domain to distinguish
+ // this user from the other one with the same display name.
+ const std::wstring& email = UTF8ToWide(user_.email());
+ size_t at_pos = email.rfind('@');
+ if (at_pos == std::wstring::npos) {
+ NOTREACHED();
+ return std::wstring();
+ }
+ size_t domain_start = at_pos + 1;
+ std::wstring domain = email.substr(domain_start,
+ email.length() - domain_start);
+ return base::StringPrintf(L"%s (%s)",
+ user_.GetDisplayName().c_str(),
+ domain.c_str());
+}
+
void UserController::ClearAndEnablePassword() {
- if (is_guest_) {
+ if (is_new_user_) {
new_user_view_->ClearAndEnablePassword();
} else {
existing_user_view_->password_field()->SetText(string16());
@@ -183,7 +190,7 @@ void UserController::ClearAndEnablePassword() {
}
void UserController::ClearAndEnableFields() {
- if (is_guest_) {
+ if (is_new_user_) {
new_user_view_->ClearAndEnableFields();
} else {
ClearAndEnablePassword();
@@ -191,12 +198,9 @@ void UserController::ClearAndEnableFields() {
}
void UserController::EnableNameTooltip(bool enable) {
- if (is_guest_)
- return;
-
std::wstring tooltip_text;
if (enable)
- tooltip_text = UTF8ToWide(GetNameTooltip(user_));
+ tooltip_text = GetNameTooltip();
if (user_view_)
user_view_->SetTooltipText(tooltip_text);
@@ -218,10 +222,10 @@ bool UserController::HandleKeystroke(
Login();
return true;
} else if (keystroke.GetKeyboardCode() == app::VKEY_LEFT) {
- SelectUser(user_index() - 1);
+ SelectUser(user_index() - 1, false);
return true;
} else if (keystroke.GetKeyboardCode() == app::VKEY_RIGHT) {
- SelectUser(user_index() + 1);
+ SelectUser(user_index() + 1, false);
return true;
}
delegate_->ClearErrors();
@@ -245,20 +249,44 @@ void UserController::Observe(
}
void UserController::Login() {
- // Delegate will reenable as necessary.
- SetPasswordEnabled(false);
+ if (is_bwsi_) {
+ delegate_->LoginOffTheRecord();
+ } else {
+ // Delegate will reenable as necessary.
+ SetPasswordEnabled(false);
- delegate_->Login(this, existing_user_view_->password_field()->text());
+ delegate_->Login(this, existing_user_view_->password_field()->text());
+ }
}
void UserController::IsActiveChanged(bool active) {
is_user_selected_ = active;
if (active) {
delegate_->OnUserSelected(this);
- user_view_->SetRemoveButtonVisible(!is_guest_);
+ user_view_->SetRemoveButtonVisible(!is_new_user_ && !is_bwsi_);
+ // Background is NULL for inactive new user pod to make it transparent.
+ if (is_new_user_ && !border_window_->GetRootView()->background()) {
+ views::Painter* painter = CreateWizardPainter(
+ &BorderDefinition::kUserBorder);
+ border_window_->GetRootView()->set_background(
+ views::Background::CreateBackgroundPainter(true, painter));
+ border_window_->GetRootView()->SchedulePaint();
+ }
} else {
user_view_->SetRemoveButtonVisible(false);
delegate_->ClearErrors();
+ if (is_new_user_) {
+ gfx::Rect controls_bounds;
+ controls_window_->GetBounds(&controls_bounds, true);
+ gfx::Rect screen_bounds =
+ views::Screen::GetMonitorWorkAreaNearestWindow(NULL);
+ // The windows was moved out of screen so the pod was really deactivated,
+ // otherwise it just some dialog was shown and took focus.
+ if (!screen_bounds.Intersects(controls_bounds)) {
+ border_window_->GetRootView()->set_background(NULL);
+ border_window_->GetRootView()->SchedulePaint();
+ }
+ }
}
}
@@ -290,7 +318,7 @@ WidgetGtk* UserController::CreateControlsWindow(
int* height,
bool need_browse_without_signin) {
views::View* control_view;
- if (is_guest_) {
+ if (is_new_user_) {
new_user_view_ =
new NewUserView(this, false, need_browse_without_signin);
new_user_view_->Init();
@@ -302,8 +330,10 @@ WidgetGtk* UserController::CreateControlsWindow(
}
*height = kControlsHeight;
- if (is_guest_)
+ if (is_new_user_)
*height += kUserImageSize + kUserNameGap;
+ if (is_bwsi_)
+ *height = 1;
WidgetGtk* window = new WidgetGtk(WidgetGtk::TYPE_WINDOW);
ConfigureLoginWindow(window,
@@ -315,13 +345,16 @@ WidgetGtk* UserController::CreateControlsWindow(
}
WidgetGtk* UserController::CreateImageWindow(int index) {
- user_view_ = new UserView(this, true);
+ user_view_ = new UserView(this, true, !is_new_user_);
- if (!is_guest_) {
- user_view_->SetImage(user_.image());
- } else {
+ if (is_bwsi_) {
user_view_->SetImage(*ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_LOGIN_OTHER_USER));
+ IDR_LOGIN_GUEST));
+ } else if (is_new_user_) {
+ user_view_->SetImage(*ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_LOGIN_ADD_USER));
+ } else {
+ user_view_->SetImage(user_.image());
}
WidgetGtk* window = new ClickNotifyingWidget(WidgetGtk::TYPE_WINDOW, this);
@@ -330,25 +363,33 @@ WidgetGtk* UserController::CreateImageWindow(int index) {
gfx::Rect(user_view_->GetPreferredSize()),
WM_IPC_WINDOW_LOGIN_IMAGE,
user_view_);
+
+ if (is_new_user_)
+ window->MakeTransparent();
+
return window;
}
void UserController::CreateBorderWindow(int index,
int total_user_count,
int controls_height) {
- // Guest login controls window is much higher than existing user's controls
+ // New user login controls window is much higher than existing user's controls
// window so window manager will place the control instead of image window.
int width = kBorderSize * 2 + kUserImageSize;
int height = kBorderSize * 2 + controls_height;
- if (!is_guest_)
+ if (!is_new_user_)
height += kBorderSize + kUserImageSize;
+ if (is_bwsi_)
+ height = kBorderSize * 2 + kUserImageSize + 1;
border_window_ = new WidgetGtk(WidgetGtk::TYPE_WINDOW);
border_window_->MakeTransparent();
border_window_->Init(NULL, gfx::Rect(0, 0, width, height));
- views::Painter* painter = CreateWizardPainter(
- &BorderDefinition::kUserBorder);
- border_window_->GetRootView()->set_background(
- views::Background::CreateBackgroundPainter(true, painter));
+ if (!is_new_user_) {
+ views::Painter* painter = CreateWizardPainter(
+ &BorderDefinition::kUserBorder);
+ border_window_->GetRootView()->set_background(
+ views::Background::CreateBackgroundPainter(true, painter));
+ }
UpdateUserCount(index, total_user_count);
GdkWindow* gdk_window = border_window_->GetNativeView()->window;
@@ -376,15 +417,18 @@ WidgetGtk* UserController::CreateLabelWindow(int index,
const gfx::Font& font = (type == WM_IPC_WINDOW_LOGIN_LABEL) ?
rb.GetFont(ResourceBundle::LargeFont).DeriveFont(0, gfx::Font::BOLD) :
rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD);
- std::wstring text = is_guest_ ? l10n_util::GetString(IDS_GUEST) :
- UTF8ToWide(user_.GetDisplayName());
- if (index == 0 && is_guest_) {
- // This is single guest login without any existing users around because
- // non-single guest login is rightmost in current screen arrangement and
- // hence indexed above zero.
- // Such a single guest login should not be labelled.
- text = std::wstring();
+ std::wstring text;
+ if (is_bwsi_) {
+ text = l10n_util::GetString(IDS_GUEST);
+ } else if (is_new_user_) {
+ // Add user should have label only in activated state.
+ // When new user is the only, label is not needed.
+ if (type != WM_IPC_WINDOW_LOGIN_UNSELECTED_LABEL || index != 0)
+ text = l10n_util::GetString(IDS_ADD_USER);
+ } else {
+ text = UTF8ToWide(user_.GetDisplayName());
}
+
views::Label* label = new views::Label(text);
label->SetColor(kTextColor);
label->SetFont(font);
@@ -406,7 +450,7 @@ WidgetGtk* UserController::CreateLabelWindow(int index,
}
gfx::Rect UserController::GetScreenBounds() const {
- if (is_guest_)
+ if (is_new_user_)
return new_user_view_->GetUsernameBounds();
else
return existing_user_view_->password_field()->GetScreenBounds();
@@ -431,15 +475,18 @@ void UserController::ClearErrors() {
}
void UserController::NavigateAway() {
- SelectUser(user_index() - 1);
+ SelectUser(user_index() - 1, false);
}
void UserController::OnRemoveUser() {
delegate_->RemoveUser(this);
}
-void UserController::SelectUser(int index) {
- delegate_->SelectUser(index);
+void UserController::SelectUser(int index, bool is_click) {
+ if (is_click && is_bwsi_)
+ delegate_->LoginOffTheRecord();
+ else
+ delegate_->SelectUser(index);
}
void UserController::FocusPasswordField() {
diff --git a/chrome/browser/chromeos/login/user_controller.h b/chrome/browser/chromeos/login/user_controller.h
index 106ad5a..0e82191 100644
--- a/chrome/browser/chromeos/login/user_controller.h
+++ b/chrome/browser/chromeos/login/user_controller.h
@@ -57,8 +57,8 @@ class UserController : public views::ButtonListener,
virtual ~Delegate() {}
};
- // Creates a UserController representing the guest (other user) login.
- explicit UserController(Delegate* delegate);
+ // Creates a UserController representing new user or bwsi login.
+ UserController(Delegate* delegate, bool is_bwsi);
// Creates a UserController for the specified user.
UserController(Delegate* delegate, const UserManager::User& user);
@@ -76,7 +76,8 @@ class UserController : public views::ButtonListener,
int user_index() const { return user_index_; }
bool is_user_selected() const { return is_user_selected_; }
- bool is_guest() const { return is_guest_; }
+ bool is_new_user() const { return is_new_user_; }
+ bool is_bwsi() const { return is_bwsi_; }
NewUserView* new_user_view() const { return new_user_view_; }
const UserManager::User& user() const { return user_; }
@@ -130,8 +131,9 @@ class UserController : public views::ButtonListener,
// UserView::Delegate implementation:
virtual void OnRemoveUser();
- // Selects user entry with specified |index|.
- void SelectUser(int index);
+ // Selects user entry with specified |index|, |is_click| is true if the entry
+ // was selected by mouse click.
+ void SelectUser(int index, bool is_click);
// Sets focus on password field.
void FocusPasswordField();
@@ -168,20 +170,26 @@ class UserController : public views::ButtonListener,
// Sets the enabled state of the password field to |enable|.
void SetPasswordEnabled(bool enable);
+ // Returns tooltip text for user name.
+ std::wstring GetNameTooltip() const;
+
// User index within all the users.
int user_index_;
// Is this user selected now?
bool is_user_selected_;
- // Is this the guest user?
- const bool is_guest_;
+ // Is this the new user pod?
+ const bool is_new_user_;
+
+ // Is this the bwsi pod?
+ const bool is_bwsi_;
// Should we show tooltips above user image and label to help distinguish
// users with the same display name.
bool show_name_tooltip_;
- // If is_guest_ is false, this is the user being shown.
+ // If is_new_user_ and is_bwsi_ are false, this is the user being shown.
UserManager::User user_;
Delegate* delegate_;
diff --git a/chrome/browser/chromeos/login/user_image_view.cc b/chrome/browser/chromeos/login/user_image_view.cc
index 2d44887..2de6453 100644
--- a/chrome/browser/chromeos/login/user_image_view.cc
+++ b/chrome/browser/chromeos/login/user_image_view.cc
@@ -87,7 +87,7 @@ void UserImageView::Init() {
gfx::Size(kUserImageSize, kUserImageSize));
selected_image_->SetImage(
*ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_LOGIN_OTHER_USER));
+ IDR_LOGIN_DEFAULT_USER));
AddChildView(selected_image_);
UpdateLocalizedStrings();
diff --git a/chrome/browser/chromeos/login/user_view.cc b/chrome/browser/chromeos/login/user_view.cc
index 529f32a..77afcb9 100644
--- a/chrome/browser/chromeos/login/user_view.cc
+++ b/chrome/browser/chromeos/login/user_view.cc
@@ -175,7 +175,7 @@ class RemoveButton : public views::TextButton {
DISALLOW_COPY_AND_ASSIGN(RemoveButton);
};
-UserView::UserView(Delegate* delegate, bool is_login)
+UserView::UserView(Delegate* delegate, bool is_login, bool need_background)
: delegate_(delegate),
signout_view_(NULL),
image_view_(new views::ImageView()),
@@ -185,12 +185,14 @@ UserView::UserView(Delegate* delegate, bool is_login)
if (!is_login)
signout_view_ = new SignoutView(this);
- Init();
+ Init(need_background);
}
-void UserView::Init() {
- image_view_->set_background(
- views::Background::CreateSolidBackground(kBackgroundColor));
+void UserView::Init(bool need_background) {
+ if (need_background) {
+ image_view_->set_background(
+ views::Background::CreateSolidBackground(kBackgroundColor));
+ }
if (throbber_) {
int w = throbber_->GetPreferredSize().width();
int h = throbber_->GetPreferredSize().height();
diff --git a/chrome/browser/chromeos/login/user_view.h b/chrome/browser/chromeos/login/user_view.h
index 54d08f4..772910c 100644
--- a/chrome/browser/chromeos/login/user_view.h
+++ b/chrome/browser/chromeos/login/user_view.h
@@ -41,8 +41,9 @@ class UserView : public views::View,
// Creates UserView for login screen (|is_login| == true) or screen locker.
// On login screen this will have addition menu with user specific actions.
- // On screen locker it will have sign out button.
- UserView(Delegate* delegate, bool is_login);
+ // On screen locker it will have sign out button. |need_background| is needed
+ // to show image with transparent areas.
+ UserView(Delegate* delegate, bool is_login, bool need_background);
// view::View overrides.
virtual gfx::Size GetPreferredSize();
@@ -72,7 +73,7 @@ class UserView : public views::View,
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
private:
- void Init();
+ void Init(bool need_background);
void BuildMenu();
Delegate* delegate_;